Erectile dysfunction is the inability to achieve and maintain a firm erection and can include the inability to ejaculate. Erectile dysfunction can happen to men at any age, although chances increase as you age. Some common causes of erectile dysfunction include: poor mental health, obesity, substance use, diabetes, high blood pressure, prostate cancer treatments and certain medications.