In the context of cancer, a urostomy is often required when the bladder is affected by cancer, particularly advanced or invasive bladder cancer. It might also be necessary after treatments for other pelvic cancers that damage the bladder or urinary tract. This procedure helps in ensuring that urine can still be expelled from the body safely and effectively.