An ostomy is surgery to create an opening (stoma) from an area inside the body to the outside. It treats certain diseases of the digestive or urinary systems. It can be permanent, when an organ must be removed. It can be temporary, when the organ needs time to heal. The organ could be the small intestine, colon, rectum, or bladder. With an ostomy, there must be a new way for wastes to leave the body.
There are many different types of ostomy. Some examples are
Ileostomy - the bottom of the small intestine (ileum) is attached to the stoma. This bypasses the colon, rectum and anus.
Colostomy - the colon is attached to the stoma. This bypasses the rectum and the anus.
Urostomy - the tubes that carry urine to the bladder are attached to the stoma. This bypasses the bladder.
NIH: National Institute of Diabetes and Digestive and Kidney Diseases