Urinary retention can be directly or indirectly related to cancer. Direct causes include tumors in the bladder, prostate, or other parts of the urinary tract that physically obstruct urine flow. Indirect causes can include side effects of cancer treatments, such as radiation therapy or certain medications like opioids that affect bladder function.