Narrated Abu Huraira
Allah's Messenger (ﷺ) said, "Horses may be used for three purposes: For a man they may be a source of reward (in the Hereafter); for another, a means of protection; and for another, a source of sin. The man for whom they are a source of reward, is the one who keeps them for Allah's Cause and ties them with long ropes and lets them graze in a pasture or garden. Whatever those long ropes allow them to eat of that pasture or garden, will be written as good deeds for him and if they break their ropes and run one or two rounds, then all their footsteps and dung will be written as good deeds for him, and if they pass a river and drink from it though he has had no intention of watering them, even then, that will be written as good deeds for him. So such horses are a source of reward for that man. For the man who keeps horses for his livelihood in order not to ask others for help or beg his bread, and at the same time he does not forget Allah's right of what he earns through them and of their backs (that he presents it to be used in Allah's Cause), such horses are a shelter for him (from poverty). For the man who keeps them just out of pride and for showing off, they are a source of sin." Then Allah's Messenger (ﷺ) was asked about donkeys. He said, "Allah has not revealed anything to me regarding them except this comprehensive Verse: "Then anyone who has done good, equal to the weight of an atom (or a small ant) shall see it, and any one who has done evil, equal to the weight of an atom (or a small ant) shall see it." (99.7-8)