Stress and other psychological factors can cause erectile dysfunction. When erectile dysfunction is caused by psychological factors, the man has erections while sleeping or early in the morning before going to the bathroom but cannot achieve an erection when making love.