Philippi, where Paul and Silas spent time in a jail cell, was a city in eastern Macedonia established by King Philip II of Macedon. The king started the city in 356 B.C., the same year his son and heir to the throne Alexander III (also known as Alexander the Great) was born. The objective of founding the town was to take control of the neighboring gold mines and to establish a garrison at a strategic passage.
Paul's time in this jail cell occurred during his second missionary journey. In Troas he sees a vision of a man in Macedonia (Greece) asking for help (Acts 16:8-9). He, Silas and others immediately set sail for Neapolis. From Neapolis they travel to Philippi.
While in the city Paul meets a slave. Sensing that she was demon possessed he casts the evil spirit out of the woman. The slave's masters, angered that the profitable fortune telling skills she had are now gone, go on a campaign to get as many as possible to be against the preachers. The evangelists are taken into custody, beaten and thrown in a Philippian jail! They and the other prisoners, however, are soon freed due to a miracle. An earthquake occurs that causes Paul's cell door to open and his bonds to loosen up. This not only happens to him but to all those within the prison.
The jailor is awoken by the earthquake, sees the doors of the jail open and assumes all the prisoners have escaped. He then grabs his sword so that he can commit suicide. Why? Sleeping while on watch (e.g. guarding prisoners) was a crime in the Roman military. The punishment for such behavior was death! No doubt the jailor wanted to take his own life rather than have the Romans do it. The apostle Paul, however, stops him from killing himself. Then a second miracle, greater than the first, occurs.
But about midnight, Paul and Silas were praying and singing praises to God, and the prisoners were listening to them. And suddenly there was a great earthquake, so great that the foundations of the prison were shaken; and immediately all the doors opened, and the bonds of all were loosed. When the jailer awoke from his sleep and saw the doors of the prison open, he drew a sword and was about to kill himself, supposing that the prisoners had escaped, But Paul called out with a loud voice, saying, "Do not harm yourself; for we are all here." And after asking for lights, he rushed in and fell down trembling before Paul and Silas.
And when he had brought them out, he said, "Sirs, what must I do, that I may be saved?" Then they said, "Believe in the Lord Jesus Christ, and you shall be saved, you and your household." And they spoke the word of the Lord to him, and to all those in his house. And he took them in that hour of the night, and washed their wounds; and he and all his household were immediately baptized. (Acts 16:25-33)
Interestingly, Paul wrote several of his epistles from a prison jail cell. He penned the epistles to the Ephesians, Philippians, Colossians and Philemon during his first Roman imprisonment from 61 to 63 A.D. He also wrote his last known letter, an epistle to his good friend and traveling companion Timothy (2 Timothy), while during his final Roman imprisonment in 67 A.D.