Many veterinarians and breeders suggest and condone castration that results in an animal being neutered or sterilized. For those of us that fear G-d and wish to observe his commandments castration is not an option.
In the Bible we see the commandment written in Leviticus 22:24 as follows:

One whose testicles are squeezed, crushed, torn, or cut, you shall not offer to God, nor shall you do these in your Land.
Rebbe Avraham Chill, Admo"r, AMUSh, ShLIT"A writes the following:
1. The reason why the practice of euthanasia is not allowed and why we are forbidden to employ contraceptives or resort to unwarranted abortions is because these usurp the prerogatives of G-d. This applies also to castration. It is G-d's choice to grant or deny offspring to his creatures; it is not within the province of man to make so momentous a decision.
2. It is forbidden to emasculate either a human being or an animal. He who commits this sin, is subject to the penalty of lashes.
3. Since the Torah warns against destroying the birth potential the Rabbis interpret this prohibition to include any medical prophylactic that would achieve the same result. In view of the fact the commandment "to be fruitful" applies only to the male of the human species, a woman may drink a "cup of ikarin" which would prevent her from conceiving.
COMMENTATORS
Hinnukh, Arabanel, Ibn Ezra: The purpose of the sexual act, both in man and among the lower animals is, according to the Divine plan, the perpetuation of the species. Man therefore has no right to allow himself to be castrated or to castrate animals; for by so doing, he is interfering with G-d's design. Ibn Ezra adds that man must not change any of the physical features with which G-d has endowed His creatures.
Recanati: When a person permits himself to be castrated or sterilized, he knows that he can never again beget children. If he, nonetheless, undergoes this operation, it becomes apparent that he must be so dissatisfied with the world that he does not care if it ceases to continue. The truth is, however, that there is a disaster if it did terminate. G-d meant man to enjoy the world; by becoming castrated or sterilized, man demonstrates that he does not enjoy or appreciate what G-d has given him.
References: B. Sanhedrin, 70a; B. Kiddushin 25b; B. Shabbat 110b, 111a; B. Hagigah 14b; B. Bava Metzia 90b; Yad, Hilkhot Issurei Bi'ah, Chap. 16; Sefer ha-Mitzvot (Lo Ya'aseh) 361; Sefer Mitzvot Gadol (Lav) 120; Sefer Mitzvot Katan 166; Shulhan Arukh, Even ha-Ezer, 5; Sefer ha-Hinnukh, Mitzvah 291.