An ostomy bag is a medical device attached to the body to collect waste from a surgically diverted biological system, such as the colon or ileum, through an opening called a stoma. It is essential for individuals who have undergone surgeries like colostomy or ileostomy, allowing them to manage waste excretion effectively and maintain quality of life.