Although most cases of ED have a physical cause, thoughts that lead to depression, worry, or anxiety can also cause ED. Even when ED has a physical cause, it can be made worse if it leads to depression and worry. Diabetes is a condition where there is too much sugar, or glucose, in the blood.or example, it's associated with medical conditions that can affect blood flow. And when blood flow is affected, it can cause ED. The prostate is a small gland near your bladder. It's next to the nerves that are necessary for an erection to happen.