From the Greek word [stoma] meaning "mouth or opening", and the suffix [-y] meaning "process or condition". The suffix [-(o)stomy] refers to the "process of creating an opening". This process can be physiological, without intervention, as in the creation of a spontaneous fistula, or it can be a surgical procedure.
As a working explanation of [-ostomy] in surgery, we like to use the term "drainage". Therefore, an [ileostomy] would be the procedure by means of which a drainage opening is creating an anastomosis between the ileum and the abdominal wall.
The accompanying image shows an early 1900's procedure to create a gastrostomy (Wietzel's gastrostomy). The root term [gastr-] means "stomach".