Fiqh-us-Sunnah Volume 3, Zakaat and Fasting, Fiqh 3.104.

Section : Sadaqah on Animals.

The Messenger of Allah, upon whom be peace, is reported to have said: “While a man was walking along a road, he became very thirsty and found a well. He lowered himself into the well, drank, and came out. Then [he saw] a dog protruding its tongue out with thirst. The man said: ‘This dog has become exhausted from thirst in the same way as I.’ He lowered himself into the well again and filled his shoe with water. Then he took the dog by the mouth until he had raised himself. He gave the dog some water to drink. He thanked Allah, and [his sins were] forgiven.” They asked: “O Messenger of Allah, upon whom be peace! Is there a reward for us in our animals?” He said: “There is a reward in every living thing.” This is related by al-Bukhari and Muslim.

The two also related that the Messenger of Allah, upon whom be peace, said: “While a dog was walking around a well, his thirst was near to killing him. One of the prostitutes of the Banu Isra’il saw him. She took off her shoe and drew water for him with it in order to quench his thirst. [For that] she was forgiven [by Allah].”