Paul gets thrown into jail at Philippi. He heals a girl who can tell the future, meaning that her slave-owners can’t make money off of her any more. They get very angry. There is a mob in the marketplace, which is probably where Paul had a booth to sell tents. He probably shared the gospel while he engaged in his business. So it is no surprise to see public trouble break out in the marketplace.
They beat Paul and Silas and throw them into jail. Paul mentions in 2 Corinthians 11:25 that he had already been beaten 3 times with rods by the time he wrote 2 Corinthians. Presumably Philippi was one of these times. Roman citizens, of course, were not supposed to be beaten without charges and a trial. Once the magistrates find that they have unlawfully beaten Roman citizens (Silas is also a citizen), they get very nervous.
This event marks a kind of transition between Paul and his Roman citizenship. Perhaps he was embarrassed about it when he was a Pharisee in Jerusalem. On the island of Cyprus, he embraced his Roman name or nickname, "Paul." From now on, he will begin to use his Roman citizenship to get out of beatings. Why get beat when he doesn't have to?
Paul is a model of calmness throughout the incident. He does not hold a grudge against those who have wrongly beaten him. He later does insist they come and escort him out of the jail, showing that he has the moral high ground. In the meantime, he and the others sing hymns in jail well into the night.
An earthquake makes it possible for Paul and others to escape. But he maintains order. The jailer almost kills himself so that he would not be killed by his superiors as a penalty. He thinks all the prisoners will have escaped. So Paul saves the jailer’s life by keeping everyone in place.
After Paul has saved the jailer’s life, the jailer asks what he needs to do to be saved. The jailer means, "What can I do to keep you from escaping?" Paul's answer is somewhat humorous, switching the topic to eternal salvation. “Believe in the Lord Jesus, and you will be saved” (16:31). Paul adds that the jailer's whole household will be saved as a result, another indication of the group orientation of that culture. Paul apparently sees the father here making a decision for his whole family.
The man and his family are baptized on the spot, in the middle of the night. The man seems to live in the jail with his family. This story says something about how flexible the mode of baptizing must have been for the early Christians. A river might have been ideal, but it is hard to imagine there being enough water in the prison for anything but pouring as a mode in this instance. The jailer washes their wounds in the jail and Paul washes away his sins there too.