Shockwave therapy for erectile dysfunction works by stimulating the growth of new blood vessels in the penis, improving blood flow, and enhancing the ability to achieve and maintain erections.