In other words, there are dozens of reasons he might not be getting it up, which have absolutely nothing to do with your relationship. Honestly, there's just no way for me to give you specific advice here. If it's a serious problem, you should encourage him to check in with his primary care physician first, and then, perhaps, a therapist, in the nicest way possible.
In other cases, men who habitually use alcohol or other drugs may experience similar results. Alcohol is a depressant to the central nervous system. This means that a little bit might be able to lighten the mood, but too much can basically shut down all communication between the brain and the penis. When this happens, no amount of will or stimulation will result in an erection. Other drugs can also affect the body’s ability to achieve an erection, including heroin and MDMA, otherwise known as ecstasy.