All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
Indeed there is evidence in the Sunnah that it is permissible to build mosques in places of Shirk [associating partners to Allaah], and churches are included in this, after changing the slogans of disbelief.
Imaam An-Nawawi said: 'It is permissible to build a mosque in a place where there is a church, a synagogue, or grave if bones or corpses where removed from it. It is confirmed that Anas narrated that the Prophet's mosque contained graves so they were unearthed. In relation to churches and synagogues, it is confirmed that the Prophet commanded a mosque to be built for the people of Taa'if where they used to worship their idols [after having destroyed them].' [Abu Daawood]'
Moreover, when the companions conquered
Therefore, it is permissible to transform a church into a mosque and there is no harm to pray in a mosque which was originally a church. Moreover, it is also permissible to pray even in the church according to the view of many righteous predecessor scholars like Al-Hassan and 'Umar Ibn 'Abdul-'Azeez, Ash-Shu'bi and others. The evidence for this is the saying of the Prophet said: "Whenever the time of the prayer comes, pray as wherever you are is a mosque." [And this is a general statement] [Al-Bukhari and Muslim]
However, some other scholars disliked praying in a church because of the pictures that it contains.
Allaah Knows best.