عن عبد الله بن عمر رضي الله عنهما قال: سمعت رسول الله صلى الله عليه وسلم يقول: «مَن اقْتَنَى كَلْبًا -إلا كلبَ صَيْدٍ، أو مَاشِيَةٍ- فإنه يَنْقُصُ من أَجْرِهِ كل يوم قِيرَاطَانِ».
قال سالم: وكان أبو هريرة يقول: «أو كلبَ حَرْثٍ»، وكان صَاحِبَ حَرْثٍ. [صحيح] - [متفق عليه] المزيــد ...
‘Abdullāh ibn ‘Umar (may Allah be pleased with him) reported that the Prophet (may Allah's peace and blessings be upon him) said: "If anyone keeps a dog that is neither for hunting nor for guarding livestock, their reward (for good deeds) will be reduced by two Qirāts per day."
Sālim said that Abu Hurayrah, who had a farm, used to say:"Or a farm dog." Sahih/Authentic. - [Al-Bukhari and Muslim]
A dog is a despicable filthy animal, and that is why Islamic Shariah forbade owning it because of the harms and bad consequences resulting from keeping it. Examples of these harms include the following: The honorable and obedient angels turn away from the house where a dog is kept; dogs frighten and terrify people; dogs are a source of impurity and harm; and owning a dog is a sign of foolishness.
Therefore, anyone who keeps a dog their rewards of good deeds will decrease considerably every day. This amount is translated into two Qirāts, which only Allah knows how big they are, because such a person insists on disobeying Allah by keeping a dog.
However, if there is a need for keeping a dog, it is allowed to do so in three cases:
1- Guarding livestock against wolves and thieves.
2- Guarding crops.
3- Hunting animals.
A Muslim is allowed to keep a dog for any of these purposes, and is no longer blamed for doing so.