Introduction Mental health disorders are prevalent in the United States, Iraq, and Afghanistan war veterans. Mental illness, including posttraumatic stress disorder (PTSD) with or without psychiatric medications, can increase the risk for male sexual dysfunction, threatening quality of life. Aims We sought to determine the prevalence and correlates of sexual dysfunction among male Iraq and Afghanistan veterans. Methods We performed a retrospective cohort study of 405,275 male Iraq and Afghanistan veterans who were new users of U.S. Department of Veterans Affairs healthcare from October 7, 2001 to September 30, 2009 and had 2-year follow-up. Main Outcome Measures We determined the independent association of mental health diagnoses and sexual dysfunction after adjusting for sociodemographic and military service characteristics, comorbidities, and medications. Results Veterans with PTSD were more likely to have a sexual dysfunction diagnosis, be prescribed medications for sexual dysfunction, or both (10.6%), compared with veterans having a mental diagnosis other than PTSD (7.2%), or no mental health diagnosis (2.3%). In a fully adjusted model, PTSD increased the risk of sexual dysfunction by more than threefold (adjusted risk ratio = 3.61, 95% CI = 3.48-3.75). Veterans with mental health disorders, particularly PTSD, were at the highest risk of sexual dysfunction when prescribed psychiatric medications (adjusted risk ratio = 4.59, 95% CI = 4.41-4.77). Conclusions Among U.S. combat veterans, mental health disorders, particularly PTSD, increased the risk of sexual dysfunction independent of the use of psychiatric medications.