The Holy Quran does not prohibit anyone from visiting a mosque (provided they are not there to cause trouble) as it is a House of God that can and should be used for the worship of God by all. Only idolatry is prohibited in a mosque but even then all are welcome to visit a mosque. This declaration against idolatry in a mosque was to protect the Ka’aba (and therefore any mosque) and to ensure that it would remain a sanctuary for those who believe in the Oneness of God.
According to Islam non-Muslims are even allowed in the Sacred Mosque in Makkah and Madinah.
It is recorded that the Christians of Najran came to see the Holy Prophet Muhammad(sa). He arranged the meeting in his mosque at Madinah, during the meeting the Christians asked leave from the mosque for worship. The Prophet(sa) said that the mosque in which they were was a house of God and they were welcome to offer their prayers there. So they did offer their prayers in the mosque of the Holy Prophet(sa). (Ibn Hisham, I, 575-577)