The purpose of creation is to increase life in the world, as the Torah says at the end of the creation story: “God blessed them and God said to them, ‘Be fruitful and multiply, fill the earth and conquer it’” (Bereishit 1:28; similarly, ibid. 1:22, 8:17, 9:1, 7). As an extension of this, the Torah prohibits castrating any male, human or animal. It says regarding sacrificial offerings, “You shall not offer to the Lord anything [with its testes] bruised or crushed or torn or cut. You must not do this in your land” (Vayikra 22:24). The Sages understand “You must not do this” to be a prohibition on damaging the reproductive organs, and “in your land” to be an extension of the prohibition to any male, animal or human. The penalty for castrating is lashes. Although the Torah uses the words “in your land,” the Sages have a tradition that the prohibition applies outside Eretz Yisrael as well (Shabbat 110b; MT, Laws of Sexual Prohibitions 16:10).
The male reproductive system has three main components: the testicles (which produce sperm), the vas deferens or sperm ducts, and the penis. Severely damaging any one of them causes sterility and violates a Torah prohibition. Even “castrating” someone who has already been sterilized is a prohibition. Thus, if one man attacks another and crushes his testicles, rendering the victim sterile, and afterwards another person comes over and cuts off the victim’s testicles, a third performs a vasectomy, a fourth smashes his penis, and a fifth cuts it off, each one transgresses a Torah prohibition and is punished with lashes (Shabbat 111a; SA EH 5:11).
Even drinking a potion which induces sterility is prohibited (Shabbat 111a; SA EH 5:11). We can derive this from the next verse, “For they are mutilated (moshḥatam bahem), they have a defect” (Vayikra 22:25). In other words, destroying (hashḥata) a man’s ability to have children is prohibited. However, since this type of “castration” is indirect (as it does not directly damage reproductive organs), many say that it is prohibited only rabbinically. Others maintain that the prohibition is from the Torah but does not incur lashes since it does not directly damage the reproductive organs.
Some say that one may castrate a man who has a history of sexual violence, in order to save women or children from rape and, in rare cases, murder (Responsa Menaḥem Meshiv 2:18). Temporary chemical castration is certainly permitted to prevent rape, even when there is no threat to life, although under normal circumstances it is forbidden rabbinically (see Yad Yehuda 5:11-12, p. 431; Responsa Asher Ḥanan 6-7:62). Chemical castration entails injecting female hormones (estrogen) into a man or giving him drugs that counteract testosterone and other androgens. This type of sterilization temporarily makes it impossible for a man to impregnate a woman and largely suppresses his sexual drive.