The Torah contains a number of commandments whose purpose is clearly to prevent animal suffering and to educate people to compassion, toward animals as well (the interpretation and reasoning are generally according to "Sefer HaChinuch"):
The commandment to unload a burden: to remove the load from an animal exhausted by its burden on the road. "If you see the donkey of one who hates you lying under its burden, you shall not leave it; you shall surely help him release it." Among the roots of this commandment: to teach our souls the quality of mercy.
(Exodus 23:5)
The prohibition against eating blood: not to eat the blood of domestic animals, wild animals and birds. "And you shall eat no blood." To prevent the trait of cruelty, and to refrain from eating the blood on which life depends.
(Leviticus 7:26)
The prohibition against slaughtering an animal and its young on the same day: "Whether it is a cow or a ewe, you shall not slaughter it and its young both in one day." This is to establish the quality of compassion in our souls and to keep us far from cruelty.
(Leviticus 22:28)
The prohibition against eating a limb from a living animal: "And you shall not eat the life with the flesh", that is, a limb from a living animal (Chullin 102b). To prevent the trait of cruelty.
(Deuteronomy 12:23)
The prohibition against taking the mother with the young, and the commandment to send away the mother bird: to send the mother away from the nest before taking the young. "If a bird's nest happens to be before you, you shall not take the mother with the young. You shall surely let the mother go, and take the young for yourself." To guide us in good qualities.
(Deuteronomy 22:6–7)
The prohibition against working two kinds of animals together: "You shall not plow with an ox and a donkey together." A matter of animal suffering: animals are greatly distressed at living with those not of their own kind and working with them.
(Deuteronomy 22:10)
The prohibition against muzzling an animal while it works: not to prevent an animal from eating from the produce while it is working. "You shall not muzzle the ox when it treads out the grain." To teach ourselves that our souls should be fine souls, choosing what is right, clinging to it, and pursuing kindness and compassion.
(Deuteronomy 25:4)
Indeed, the Talmud and the Midrash contain stories that emphasize the demand for compassion toward animals. Below is an extreme example of such a demand, as told about Rabbi Judah the Prince.
In the Talmud: "Rabbi's sufferings came about because of an incident and left because of an incident. A calf was being led to slaughter. It went and hung its head in the corner of Rabbi's garment and wept. Rabbi said to the calf: Go, for that (slaughter) is what you were created for. It was said in heaven: Since he has no compassion for creatures, let sufferings come upon him. One day, Rabbi's maidservant was sweeping the house. There were young weasels there, and she was sweeping them away. Rabbi said to her: Leave them, for it is written: 'And His mercies are over all His works' (Psalms 145:9). It was said in heaven: Since he is compassionate, let us have compassion on him." (Bava Metzia 85a, according to the Steinsaltz translation)
The verse (recited every day in the morning and evening prayers as part of the Shema) "And I will give grass in your fields for your cattle, and you shall eat and be satisfied" (Deuteronomy 11:15) serves as the basis (in Berakhot 40a) for the law requiring a person to feed their animals first and only then to eat themselves.
However, Jewish law as ruled permits every use of animals for all human needs, and certainly for medical needs
(With the help of Bar-Ilan University's Responsa Project CD.)
Rabbi Israel ben Petachiah Isserlein (Maharai), author of the book Terumat HaDeshen, one of the great rabbis of Ashkenaz (born in Regensburg in 1390, he served as rabbi in Wiener Neustadt, where he died in 1460), ruled that: "There is no prohibition of animal suffering if he does it for his needs and uses." (Terumat HaDeshen, section 105)
Rabbi Moses ben Israel Isserles (the Rema) (born in 1525 in Kraków, Poland, where he died in 1572) was the greatest halachic authority of Ashkenazi Europe. When Rabbi Joseph Karo wrote his classic book, the Shulchan Aruch, the Rema added glosses to it according to the rulings of the Ashkenazi authorities, so that one book of Jewish law serves both Sephardi and Ashkenazi Jewry. The Shulchan Aruch with the glosses of the Rema is accepted to this day as binding Jewish law. "Anything that is needed for medicine or for other things is not subject to the prohibition of animal suffering." (Shulchan Aruch, Even HaEzer, section 5, paragraph 14)
Rabbi Jacob ben Joseph Reischer (1670–1733) served as rabbi in the communities of Prague, Ansbach (Bavaria), Worms and Metz. His book of responsa, Shvut Yaakov, was widely circulated. "…Anything that has any need, whether for healing the body or for any financial benefit, has no concern of the prohibition of wasteful destruction or of animal suffering, and there is not even a measure of piety here." (Shvut Yaakov, part 3, section 71)
Rabbi Ezekiel ben Judah Landau, author of the book Noda BiYehuda (born in 1713 in Poland, died in 1793 in Prague), served as rabbi in Poland and later in the community of Prague and all the communities of Bohemia. His yeshiva became a great center of Torah, and questions of Jewish law were sent to him from all over Europe. In his reply to a Jew "whom God has blessed with a large estate, and who has forests and fields in which all the beasts of the forest roam", who asked whether he was allowed to hunt, or whether it was forbidden because of animal suffering or wasteful destruction, he answered that according to the law there is no prohibition of animal suffering here, as explained in the rulings of the Maharai in Terumat HaDeshen (section 105), that anything that meets a human need is not subject to the prohibition of animal suffering. At the same time, the author did not refrain from expressing his reservations about hunting: "Indeed, I am very surprised at the matter itself, for we find no hunter except Nimrod and Esau, and this is not the way of the children of Abraham, Isaac and Jacob"… And he concludes: "Therefore there is in this matter a reprehensible trait, namely cruelty, and also a prohibition and a danger, and also a reminder of one's sins. Therefore, whoever listens to me will dwell securely, quiet and at ease in his home, and will not waste his time on such things." (Noda BiYehuda, second edition, Yoreh De'ah, section 10)
Examples of rulings on animal suffering and animal experiments in our generation
Rabbi Yechiel Yaakov Weinberg (born in Russia in 1885, died in Montreux in 1966) studied in the yeshivas of Lithuania, where he absorbed their method of Talmudic scholarship and the Musar teachings of Rabbi Israel Salanter. During World War I he emigrated to Germany and was later appointed head of the Rabbi Azriel Hildesheimer Rabbinical Seminary in Berlin, until it was closed by the Nazis. He was a Talmudic genius who answered many questions of Jewish law and educated generations of rabbis, leaders and thinkers. During World War II he was imprisoned by the Nazis in camps. After the war he settled in Switzerland. "In conclusion… it is permitted to cause suffering to animals for the benefit of medical science. Moreover, in my opinion there is not even a measure of piety in refraining from causing suffering to animals for medical benefit, for a measure of piety applies where it concerns only oneself and a person may be strict with himself, but not where it concerns others; for why should you prefer preventing the suffering of animals over the suffering of the sick, whom it may perhaps be possible to help? And the Tosafot wrote something similar in Avodah Zarah 11a… And where it concerns the public, there is no reason to be strict on the grounds of piety. Therefore, in my humble opinion, it is permitted to allow doctors to carry out experiments without any hesitation or doubt." (Responsa Seridei Esh, part 2, section 91, page 606)
Rabbi Eliezer Yehuda Waldenberg, born in 1917, served as head of a rabbinical court in Jerusalem. In his books, Tzitz Eliezer, he deals with contemporary questions, especially in the fields of Jewish law and medicine and the laws of the state. He was asked whether it is permitted to carry out research on the eyes of animals, and to kill them, in order to diagnose eye diseases and find a remedy and cure. He replied that it is permitted to carry out the research on the eyes of animals, and also to kill them afterward for diagnostic purposes. The rabbi emphasized that suffering must be prevented in the laboratory animals by using anesthesia. (Tzitz Eliezer, part 14, section 68)
Rabbi Pinchas Zvichi, born in Jerusalem (1960), where he serves as a rabbi: it is permitted to carry out medical experiments on animals, whether experiments testing new drugs or experiments involving various operations on the bodies of the animals for the sake of knowledge in human medicine. (Ateret Paz, part 1, volume 3, Choshen Mishpat, section 9)