Narrated Abu Huraira
Allah's Messenger (ﷺ) said, " Horses are kept for one of three purposes: A man may keep them (for Allah's Cause) to receive a reward in the Hereafter; another may keep them as a means of protection; and a third may keep them to be a burden for him. As for the man for whom the horse is a source of reward, he is the one who ties it for Allah's Cause, and he ties it with a long rope in a pasture or a garden, then, whatever it eats or drinks in that pasture or garden will be added to his good deeds. And if it breaks its rope and jumps over one or two hills, then, for all its footsteps and its manure, good deeds will be written for him. And if it passes by a river and drinks of its water though its owner had no intention to water it from that river, even then he will have good deeds written for him. So that horse will be (a source of) reward for such a man. If a man ties a horse for earning his livelihood and abstaining from asking others for help and he does not forget Allah's right, i.e. pays its Zakat and gives it to be used in Allah's Cause, then that horse will be a means of protection for him. But if a man ties it out of pride and to show off and to excite others, then that horse will be a burden (of sins) for him." Then Allah's Messenger (ﷺ) was asked regarding donkeys. He replied, "Nothing has been revealed to me except this comprehensive Verse which includes everything: 'So whoever does good equal to the weight of an atom (or a smallest ant) shall see it; and whoever does evil equal to the weight of an atom (or a smallest ant) shall see it.' (99.7-8)