In order to have normal erections there is a coordination of processes that's very important. And this coordination has to occur between the brain, between the nerves that actually go to the penile tissues, and between the blood vessels that also go to these penile tissues.
The process of some surgeries or surgical procedures there can be damage to the nerves, and blood vessels that go to the area of the penis. Some common surgical procedures that are done that can result in erectile dysfunction include, prostrate surgery both for benign conditions, and for prostrate cancer. A procedure called a radical prostatectomy involves removal of the entire prostrate for prostrate cancer. And erectile dysfunction is quoted as a common potential side effect to this particular operation.
Erectile dysfunction can also occur as a result of surgery that has been done for benign prostatic conditions. However, the risk or erectile dysfunction with these types of surgeries is much, much lower when compared to the surgery that's done for prostate removal for prostate cancer.
There are other surgeries that may be done in the pelvic area. For example if you have rectal cancer, and require removal of the rectum, or bladder cancer and require removal of the bladder. These procedures can also damage the nerves and blood vessels that go to the penile tissues.
So, all these types of pelvic surgeries can certainly affect someone's ability to have erections. And these causes of erectile dysfunction are directly caused by the process of treating these various conditions.