Rav Yehuda said in the name of Rav, "If an animal falls into an irrigation ditch [on a festival], one may bring and place pillows and blankets under it, so that it can rise up [from the ditch] on its own . . . [Problem: In doing so] does he not nullify the [blankets and pillows] from their Shabbat use!?! [Solution: Rav Yehuda] reasons that nullifying an object from its Shabbat use is a Rabbinic prohibition, while relieving an animal's pain is a Torah requirement. The Torah requirement comes and defers the Rabbinic prohibition.
As Jews, what are our responsibilities to our animals? The Torah requires that we preserve not only our own animals from pain, but our enemies' animals as well (Exod. 23:5). Other obligations aside, we are not to pass by a struggling animal without giving assistance. What are the limits of this obligation to prevent animal suffering on Shabbat and festivals? We have seen that we may violate Shabbat for the sake of human life. May we do so for animal life as well?
In the above passage we see the case of an animal trapped in an irrigation ditch on a festival. The animal is apparently uninjured, but unable to climb out of the ditch. On a weekday, a makeshift ramp might be constructed so that the animal could be led up and out to dry land. On Shabbat and festivals, such construction is forbidden. Rav Yehuda's suggestion is to make a dry path up for the animal using pillows and blankets, preserving the animal's life and health without violating Shabbat.
But the Talmud objects: Shabbat preparations establish the utility of an item prior to Shabbat (or the festival). Blankets and pillows are for sleeping. Making a ramp out of them (particularly a wet and muddy ramp) eliminates them from use on Shabbat—they become muqtzeh (prohibited Rabbinically) because they have no further utility for the remainder of the sacred day. Since they can no longer be used as blankets and pillows, it is as if they have been destroyed, and this act of near destruction is a Rabbinic violation. But here lies the solution: the Torah's requirement to preserve the animal from suffering trumps the Rabbinic prohibition in this case. Our Sages teach us that we must relieve the animal's suffering, even though we violate a Rabbinic prohibition to do so.