But, they prayed. They had been severely beaten and you would think they wouldn't have felt much like singing. But they sang praises unto God. It was a dark, dismal dungeon with no choir or musical accompaniment. But they sang praises unto God.
Prayer is always in order.
Praising God is also always appropriate. And the prayers and praises of Paul and Silas reached to heaven. God heard and answered their prayers. Their singing pleased Him. The Scripture says that there was an earthquake.