The Jerusalem Talmud (Tractate Megillah) quotes Rav Imi telling his assistant that if a scholar should visit and need to sleep in the Synagogue, he should let him, and allow him to bring his donkey and other objects in as well.
This opinion is codified in the Ran in Tractate Megillah.
Rabbi Moshe Feinstein in his famous Responsa writes concerning a seeing-eye dog:
“Certainly a dog is no worse than a donkey, and there are no greater extenuating circumstances than this, for if we don’t permit him [to bring in the dog] he will never be able to pray with a minyan nor hear the reading of the Torah...but it would be best if he sat near the door so as not to create confusion for the congregation.”
Due to a technicality regarding the differences in the assumed-intents when constructing a Synagogue in Israel as opposed to outside of Israel, Rabbi Feinstein wrote a decision only for Synagogues outside of Israel — although he also offered an argument that would allow a seeing-eye dog in a Synagogue in Israel as well.