After baptizing Lydia and her household, Paul continues his evangelism in Philippi. He performs an exorcism on a slave girl. The consequent loss of her ability to tell fortunes so upsets her owners that they have Paul and Silas arrested.
Being a Christian, doing Christian things does not impute immunity. They go to prison.
Being a Christian, doing Christian things is not restricted to a church building. They witness to a jailer who then seeks baptism.
Notice that they stop and speak to the jailer rather than take the opportunity to escape. The prison doors are open, but they choose to comfort and protect their jailer.