Praise be to Allah.
There is nothing wrong with castrating animals such as sheep and cattle if it is done for a reason, such as making them grow fat and making the meat better. The Prophet (peace and blessings of Allaah be upon him) sacrificed castrated sheep, as it was narrated by Ahmad and Ibn Maajah (3122) that the Prophet (peace and blessings of Allaah be upon him) sacrificed two large, castrated rams. Classed as saheeh by al-Albaani in Saheeh Ibn Maajah.
The fuqaha’ differed concerning this issue, as it is mentioned in al-Mawsoo’ah al-Fiqhiyyah (19/112): The Hanafis stated that there is nothing wrong with castrating animals, because it is beneficial for the animal and for people.
According to the Maalikis, It is permissible to castrate animals that are eaten, and that is not makrooh, because it makes the meat better.
The Shaafa’is differentiated between animals that are eaten and those that are not eaten. They said: It is permissible to castrate those whose meat is eaten when they are young, but it is haraam in other cases. They stipulated that castration should not lead to the death of the animal.
As for the Hanbalis, in their view it is permissible to castrate sheep because it makes their meat better, and it was said: It is makrooh in the case of horses and other animals. End quote.
A hadeeth was narrated which forbids castration of animals, and horses in particular, but it is da’eef (weak).
That was narrated by Ahmad (4769) from Ibn ‘Umar (may Allaah be pleased with him), who said: The Messenger of Allaah (peace and blessings of Allaah be upon him) forbade castrating horses and other animals. Ibn ‘Umar said: Because that is how they increase in number. Shu’ayb al-Arna’oot said in Tahqeeq al-Musnad: Its isnaad is da’eef (weak); it was narrated in mawqoof form and in marfoo’ form, and the mawqoof form is the one which is saheeh.
Maalik and others regarded castration of horses as makrooh. He said: There is nothing wrong with castrating them if they are to be eaten. Al-Muntaqa by al-Baaji (7/268).
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said: As for castration, it is permissible if it serves an interest, but necessary steps must be taken to avoid causing pain to the animal. End quote from Liqa’ al-Baab il-Maftooh (37/15).
Conclusion: There is nothing wrong with castrating animals whose meat is eaten, according to the majority of scholars, so long as that is done for a reason and care is taken to avoid causing pain to the animal.
See also question no. 10502 for more information.
And Allaah knows best.