Islam gives permission to keep dogs for certain purposes, such as hunting, guarding livestock and protecting crops. An analogy has been made for similar purposes or those which are more essential, such as protecting houses from burglars, using them to find drugs and thieves. In any other cases, the one who keeps a dog is subject to the warning of having one or two qiraats deducted from his reward every day.
Shaykh Yoosuf ibn ‘Abd al-Haadi said, quoting from some of the scholars:
Undoubtedly the Prophet (peace and blessings of Allaah be upon him) gave permission to keep hunting dogs in several ahaadeeth, and said that keeping a dog for hunting does not detract from one’s reward. In another hadeeth he gave permission to keep a dog for herding livestock, and in another hadeeth for keeping sheep, and in another hadeeth for guarding farms. So it is known that the reason which makes it permissible to keep a dog is when it is for a purpose, and the ruling depends on whether that reason is there or not. If the reason is there, then it is permissible to keep a dog, even though some reasons are more important than agricultural reasons, and some reasons are equally important to those that are mentioned in the texts. Undoubtedly crops come under the same ruling as farms, and cattle come under the same ruling as sheep; guarding chickens and geese – to keep foxes away from them – comes under the same heading as guarding sheep. Undoubtedly the fear of burglars and keeping a dog to warn of them and wake one up is a more important reason; the Lawgiver pays attention to interests and wards off harms; if there is no reason for it then it is wrong. End quote.
Al-Ighraab fi Ahkaam al-Kilaab (p. 106-107).
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said:
Based on that, a house that is in the middle of the city has no need for a dog to guard it, so keeping a dog for this purpose in such a case is haraam and it is not permissible, and it detracts one or two qiraats from the reward of its owners every day. They should get rid of this dog and not keep it. But if a house is in the countryside and there is no one else around, then it is permissible to keep a dog to guard the house and its occupants; guarding the members of the household is more important than guarding livestock and crops. End quote.
Majmoo’ Fataawa Ibn ‘Uthaymeen (4/246).
Islam does not enjoin anything but that which is good for people, and it does not forbid them anything but that which is harmful to them. But this wisdom is known to those who know it and it is unknown to those who do not know it. The Prophet (peace and blessings of Allaah be upon him) enjoined washing vessels that have been licked by a dog, and that is only because its saliva is impure. Modern science has proven that there are several harmful things in water from which a dog has drunk. The Muslim who follows the command of sharee’ah has no choice but to obey the command, and refrain from that which is forbidden, even if he does not know the reason behind it and there is nothing wrong with trying to find out the reason behind it, but he should not make his compliance dependent upon knowing the reason.
Some of these diseases are transmitted because of going against the command of Islam, and eating and drinking from vessels used by dogs, and some of them are transmitted because the dog carries germs that cause these diseases.
Whatever the case, the Muslim hears and obeys, and goodness is found in responding to sharee’ah by doing what is commanded and avoiding what is forbidden.
And Allaah knows best.