It is not permissible to spay or castrate animals in general if it is not useful for them and if it can harm them.
However, the case for cats and other pets kept in houses is different. When these animals come together with animals outside, they may catch various illnesses and their lifespan gets shorter due to those diseases.
It is said that solutions like spaying and castrating benefit them rather than harming them and lengthen their lifespan.Therefore, it should be permissible to spay or castrate those animals based on the principle of "protecting them from the harms they can suffer and benefitting them".
It is permissible to kill harmful animals; it is also permissible to kill animals like weasels and badgers for their leather and fur, animals like deer and gazelles for their meat. It is also permissible to export the animals whose meat is not permissible to eat except pigs to non-Muslims. (Sharh an-Niqaya)
It is not permissible to kill harmless animals. It is permissible to kill harmful animals without torturing them. (Bariqa)
“When the wild beasts are herded together (in the human habitations); When the oceans boil over with a swell; When the souls are sorted out, (being joined, like with like); When the female (infant), buried alive, is questioned - For what crime she was killed; … (Then) shall each soul know what it has put forward.” (at-Takwir, 5-14)
“The claimants will get their claims on the Day of Resurrection so much so that the hornless sheep will get its claim from the horned sheep.” (Muslim Birr 15, 60)
Man cannot understand animals using himself as a criterion:
First of all, it is clear that the anguish that animals feel is devoid of man’s brain perception and the thought of death.
With what feelings animals suffer these pains should not be compared to the pains of man. For, the perception mechanism of human brain adds different meanings and content to the feelings received.
For example, the pain a patient feels due to his illness is a mechanical pain but the perceptions like hopelessness, loneliness, helplessness, absence and pitifulness are perceptions belonging to human consciousness.
In fact, what we call illness originates from this perception of grief, sadness and anguish.
Animals do not have a perception of consciousness like eternity; therefore, they do not have a perception that what they are doing is a crime or evil.
It is known that the sense of pain is tolerated by counter-hormones secreted by the brain, or that the brain cancels the sensation after a certain vibration coefficient.
Therefore, the feeling of pity felt for animals is an anthropic perception.
There are pleasures that animals get peculiar to them:
Besides, the Quran shows that even such situations of animals lacking sense of meaning will be arranged by justice and that animals will be provided with the feeling of pleasure in return for the feeling of pain.
That animals are not eternal in terms of their bodies is this lack of consciousness in terms of perception and meaning in them.
Some people appear to have a universal strained interpretation regarding this and similar questions by putting their own feelings and perceptions in the center both with an anthropic position and in an individual sense.
Consequently, this leads people to regard Allah like a human being and to try, so to speak, to question Him with wrong expressions that are not worthy of Him.
Allah does not resemble anything:
As human beings, our realm binds us. And we will be questioned about this realm.
Allah has the name as-Sabur (the Patient One) but He also has the name al-Muntaqim (the Avenger) against injustice.
Allah is free and away from all deficient attributes that are the product of our thoughts.
Anything that happens to animals is mercy:
The troubles that animals suffer is mercy for them. They will benefit forever from that mercy forever.
The name ar-Rahman means “the One meeting all needs of all living beings, especially sustenance with His mercy”.
The name ar-Rahman (the All-Compassionate) necessitates providing animals with bliss peculiar to them in the hereafter as a reward of fulfill their duties without delay. The rank of martyrdom given to those who sacrifice their life for Allah's sake can be given as both an example and evidence for it. A martyr has sacrificed his life in the way of Allah; similarly, every animal lives by fulfilling the natural duties that Allah has given to them with the organs He has bestowed on them; in a sense, they sacrifice their lives in this way. Their lives are destroyed for the sake of their duty and struggle'.
Therefore, animals receiving a spiritual wage peculiar to them and getting a spiritual pleasure in the hereafter will be a different manifestation of the name ar-Rahman.
The pleasure each animal species gets is different:
Each species of living beings is a separate realm. Human species is only one of these millions of species. We cannot comprehend the pleasure each animal species gets in this world and their spiritual rewards in the hereafter.
The pleasure that the birds flying in the sky, the fish swimming in the sea or the gazelle wandering in the forest get in this world are different from one another; similarly, their pleasures in the hereafter will different based on their abilities. We can only mentally decree that there should be a difference. However, it is not possible for us to understand the nature and characteristics of these different flavors and pleasures.
An animal does not think of the pain of death because it has no intellect. It has no problem like leaving the world. It seems to be feeling something only when it is close to being slaughtered.
Every soul shall have a taste of death:
Since everysoul shall have a taste of death, animals are also included in the scope of this rule.
Allah Almighty divided the animal kingdom into two parts as "carnivores and herbivores" with His infinite wisdom. If all animals ate grass and plants, the dead bodies of animals would be around us. According to this hypothesis, insects would not eat meat, and all of the dead bodies of more than one and a half million species of animals would be around us; or, all of them would have to be buried.
Divine wisdom makes the name ar-Razzaq (the Sustainer) manifest by making some animals food for other animals, and makes the name al-Quddus (the Pure One) manifest by arranging the cleanliness of the earth.
Animals do not progress:
Every creature has its own glorification and worship. Those who are disturbed when an animal that completes its duty and when it is time for it to die is attacked and eaten by another animal or slaughtered and eaten by human beings forget something:
There is an important difference between the killing of a human being by another human being and the killing of an animal in order to be eaten. We can think as follows: "If that man had not been killed and had lived, he could have worshipped, done good deeds and learned many things; he could have made spiritual progress." However, such progress and development is not in question for animals.
To sum up, Allah is Wise; He never does anything nonsensical and unnecessary; He is merciful; He treats people with His mercy. It is necessary to rely on His wisdom and mercy, to trust Him and to believe in Him truly.