Chemical castration is a form of punishment reserved for male sex offenders, typically pedophiles and rapists.
Chemical castration is more humane than actual castration. Additionally, it is not permanent.
Depo-Provera is the drug used today. It "acts on the brain to inhibit hormones that stimulate the testicles to produce testosterone"