Methylnaltrexone is prescribed for relieving constipation induced by opioid pain medications in individuals experiencing chronic pain not associated with cancer. It can also be given to patients with a history of cancer who are on stable doses of opioids.