An ileostomy is a surgical procedure that involves creating an opening (stoma) in the abdominal wall to divert the small intestine's contents outside the body. This is typically required when the lower part of the digestive system, such as the colon or rectum, is diseased or removed. In the context of cancer, it is often performed when a tumor obstructs or necessitates the removal of these parts of the digestive tract.