Islam, indeed, is the religion of easiness. A Muslim is allowed to perform prayer in a church if he is forced to pray there. If a Muslim prays in a church without necessity his prayer is valid but still it is reprehensible or makrooh. Whenever the necessity warrants a Muslim to perform prayer in a church, he should obtain the prior permission of the church authorities as Islam respects other people’s places of worship.
Tackling the issue from a broader perspective, the eminent Muslim scholar, Sheikh Yusuf Al-Qaradawi, states the following: The Prophet (peace and blessings be upon him) is reported to have said: “I have been given five things that no one has been given before me… (Among them is that) the earth has been made for me as a Mosque and a source of purification. So if any man from my nation realizes that he has to pray, then he may pray.
It is clear form the aforementioned Prophetic hadith that the whole earth is considered as a mosque for Muslims and a place for performing Salah and prostration.
however, it is better for one to stay away from those places (such as a church or a synagogue) out of fear of doubtful matters. If one finds it extremely difficult to find a place to perform prayer except for a church or a synagogue, and he performs salah in them then one’s prayer is valid as the whole earth is for Allah and all of it is considered a mosque (i.e., meaning a place to perform prayer and to prostrate) for all Muslims. It is reported that `UmarIbn Al-Khattab (may Allah be pleased with him) refused to pray inside the church and he prayed outside it in order to ward off any false notions that may occur to the minds of ordinary Muslims who may be enticed to pray at the exact place where `Umar performed prayer (i.e., inside the church).

Tackling the issue from another perspective, Dr. `Abdul-Fattah Idrees, professor of Comparative Jurisprudence at Al-Azhar University adds: A traveling Muslim may be allowed to perform prayer in a church if he failed to recognize a nearby mosque on his way. It is not necessary that a Muslim who does not know the mosque to perform prayer in a church as there are many other places to perform prayer.

The reason why it is not recommended for a Muslim to pray in a church is that a Muslim praying there may be distracted during performing prayer by the crosses, statues as well other Christian symbols drawn on the wall of the church.

Dr. MuzzamilSiddiqi, president of the Fiqh Council of North America (FCNA), concludes: It is permissible to pray in any place, as long the place is clean (tahir). However, praying in a church, temple or any other religious place without any necessity is makrooh.

It is possible that some people of those religions may not like to see us praying in their places of worship and we should not hurt other people’s feelings. If we have to pray in those places then we should take proper permission from the authorities that govern those sanctuaries.