An ileostomy is a surgical procedure that creates an opening (stoma) in the abdominal wall to allow the passage of stool from the small intestine (ileum) to the outside of the body. This procedure is typically necessary when the lower part of the digestive tract is not functioning properly due to conditions such as Crohn's disease, ulcerative colitis, or cancer.