On a physical level ED can be related to a number of underling health conditions. First also consider ruling out ED being due to the effects of medications or alchohol use. If neither of those are the case then it is important to note that ED can often be related to cardoviacular disease (ex: atherosclerosis, high cholesterol hypertension etc.) This makes sense at a very basic level in that if your arteries are clogged or your heart is not working properly then it is can be more difficult for the body to get an adequate amount of blood flow to the penis to form an erection.
Smoking and weight gain are also additional risk factors for developing ED.
Almost any condition that can lead to related nerve damage can also be related to ED (ex: MS Parkinson’s, spinal cord damage and diabetes as it too can lead to nerve damage and affect the body’s abilty to respond to sexual stimulation.
A third somewhat common factor that can relate to ED are hormonal deficiencies (ex: low levels of testosterone, DHEA, thyroid hormone, may all be related.) When looking into hormonal testing, which can get expensive, I recommend checking out LifeExtention.org. They have doctors on staff who can work with you over the phone to order lab work in your area and have been advocating awareness that quote “normal” ranges for hormones are not necesarily the same as an “optimal” level, especially if the ranges are quite wide and a person falls into the lower 25% of the “normal” range. While in no way intending the following as medical advice, the idea of checking in with medical professionals by seeing your doctor (with a request to get your heart checked, a general chemistry screen plus lipid panel which is relatively inexpensive and should show your cholesterol levels, making sure your doctor has ruled out diabetes) as well as learning more about what LEF.org offers regarding a full male hormone panel might be a good place to start.