There is no problem in going inside a church except for when he who goes there is a well-known figure whose going to church leads to promotion of the church or when it is feared that he might be ideologically influenced and get misled in which case the reason and Shari'ah both command him not to do an act that helps flourish and promote the church rather than a mosque. Also, a Muslim individual should keep away from dangers and anything that is likely to harm him. Therefore, he should not go to places where there is a danger or something that may do him any harm in the same way that he does not go to restaurants where he is likely to be served with contaminated and unhealthy foodstuffs. To conclude, you should take the following points into consideration in regards to going in a church:
1. If it is an abandoned church and it is no longer operating under the supervision of Christian missionaries and it is also not used by Christians for public worship and religious services (so that it may influence you ideologically), you can use that place to offer prayers and read dua there. It is permissible when the place where you offer prayers and do Sajda is not ritually impure with essential impurity which may get transferred to the body and clothe of the individual who wants to offer his prayers there. Of course, if he does not know that the place where he offers his prayers is impure, it is recommended that he should wash the place of Sajda and let it dry before hand.[1]
2. Masjid is a place of Muslims' worship and it is not permissible for Muslims to keep it empty by going to worship places of other religions.
3. Frequenting churches and being in touch with religious propagations by Christians and Jews are permissible only for those who are at a high level of religious knowledge and belief in Islamic teachings in a way such that he will not be influenced by non-Muslims' beliefs.
4. Given that Christianity emerged many years after Prophet Sulayman, how could it have been possible for Sulayman (a.s) to offer his prayers in a church?