Sleep disruption caused by obstructive sleep apnea (OSA) may be associated with hyperalgesia and may contribute to poor pain control and use of prescription opioids. However, the relationship between OSA and opioid prescription is not well described. We examine this association using cross-sectional data from a national cohort of veterans from recent wars enrolled from October 1, 2001 to October 7, 2014. The primary outcome was the relative risk ratio (RRR) of receiving opioid prescriptions for acute (<90 days/year) and chronic (≥90 days/year) durations compared to no opioid prescriptions. The primary exposure was a diagnosis of OSA. We used multinomial logistic regression to control for factors that may affect diagnosis of OSA or receipt of opioid prescriptions. Of the 1,149,874 patients (mean age 38.0±9.6 years) assessed, 88.1% had no opioid prescriptions, 9.4% had acute prescriptions, and 2.5% had chronic prescriptions. Ten percent had a diagnosis of OSA. Patients with OSA were more likely to be older, male, non-white, obese, current or former smokers, have higher pain intensity, and have medical and psychiatric comorbidities. Controlling for these differences, patients with OSA were more likely to receive acute (RRR 2.02 [95% CI 1.98, 2.06]) or chronic (RRR 2.15 [2.09, 2.22]) opioids. Further dividing opioid categories by high versus low dosage did not yield substantially different results. OSA is associated with a two-fold likelihood of being prescribed opioids for pain. Clinicians should consider incorporating OSA treatment into multi-modal pain management strategies; OSA as a target for pain management should be further studied.