The treatment of erectile dysfunction depends on the cause or causes. Stopping or changing certain medications may help. Testosterone replacement or other oral medications could also help in some cases.