First of all, it is permissible to have a guide-dog for the blind. The schools of thought who see that dog ownership to be impermissible or reprehensible permit owning dogs for legitimate benefits, based on the hadith of the Prophet (peace and blessings be upon him): “Whoever keeps a dog, except a dog that is trained for hunting or a dog for herding livestock, his reward will decrease each day by one carat” (Al-Bukhari).
As for taking a guide-dog to the mosque, it is permissible with the conditions of not permitting it inside the prayer hall and keeping it in the outside area in a kennel, and training the dog so that it will not frighten, jump on, or lick any of the mosque visitors.
Sheikh `Abdul-MajeedSubh, a prominent Al-Azhar scholar, states the following: First of all, in rural areas blind people find human aid, although in modern day cities it is very difficult for a blind person to find someone to aid him in carrying out his activities. Thus, guide-dogs serve as a very practical solution for the blind.
Secondly, the dogs used to enter the mosque of the Prophet (peace and blessings be upon him) because it did not have any fences. According to this, Imam Malik said that the dog is clean. However, we have to keep in mind that the other schools of thought hold a different view. Therefore, keeping it outside the prayer hall in a kennel fulfils the objective of aiding the blind and also does not violate the opinion of the majority of schools, who find the dog to be unclean.
Elaborating on this issue, Sheikh `AbdelKhaliq Hassan Ash-Shareef, an Egypt-based renowned scholar and da`iyah, says: Imam IbnHajar al-`Asqalani said in explaining the hadith narrated by Ibn `Umar (may Allah be pleased with him) in which the Prophet (peace and blessings be upon him) said: “Whoever keeps a dog, except a dog that is trained for hunting or a dog for herding livestock, his reward will decrease each day by one carat” (Al-Bukhari): “Ibn `Abdul-Barr says: ‘Based upon this hadith it is permissible to have a dog for hunting, guarding, and also in farming, and it is reprehensible for other than these purposes except other similar tasks by analogy. Thus, it is reprehensible to own a dog without a need because they frighten people and prohibit the entrance of angels to the house.
Additionally, this hadith has been used as a proof on the permissibility of rearing a young dog because of its benefits when it grows up, and in such case, the intention of attaining the benefits of owning this dog in the future acts as a present necessity, just like buying something that will not benefit at present for its benefit in the future.
It has been also used as a proof on the cleanness of the dog that is permissible to own, because owning a dog while staying away from it is very difficult. Therefore, the permission of its ownership is a permission of the complements of its intended objective; and this is a strong proof. Although it is opposed by the generality of the hadith obligating the cleansing of whatever a dog has licked, specifying [exceptions] from the generality is valid, if it has evidence backing it up.
This hadith also shows the kindness of Allah Almighty in permitting to His servants what has benefits to them, illustrates the role of the Prophet (peace and blessings be upon him) in informing the Ummah of rulings concerning daily activities, and proves the rule of: giving preponderance to a preferred benefit over the harm because of the exceptionality of benefiting from what has been forbidden to own.” See: Fathal-BarifiSharhSahihal-Bukhari by IbnHajar al-`Asqalani.
Based on the above, it is permissible to have a guide-dog for the blind, and it is permissible to keep it inside a kennel outside the prayer hall in the mosque. Owning a dog to aid the blind is a benefit that, by analogy, is given the same rulings of owning it for herding or guarding purposes.