"Now it happened, as we went to prayer, that a certain slave girl possessed with a spirit of divination met us, who brought her masters much profit by her fortune-telling. This girl followed Paul and us, and cried out, saying, 'These men are the servants of the Most High God, who proclaim to us the way of salvation.' And this she did for many days. But Paul, greatly annoyed, turned and said to the spirit, 'I command you in the name of Jesus Christ to come out of her.' And he came out that very hour. But when her masters saw that their hope of profit was gone, they seized Paul and Silas and dragged them into the marketplace to the authorities. And they brought them to the magistrates, and said, 'These men, being Jews, exceedingly trouble our city; and they teach customs which are not lawful for us, being Romans, to receive or observe.' Then the multitude rose up together against them; and the magistrates tore off their clothes and commanded them to be beaten with rods. And when they had laid many stripes on them, they threw them into prison, commanding the jailer to keep them securely. Having received such a charge, he put them into the inner prison and fastened their feet in the stocks" (Acts 16:16-24).
Here Luke prepares us for the next conversion he wants to detail: the Philippian jailer. Thus, Luke takes the time to detail the events that led up to Paul and Silas being arrested and thrown into prison.
One day in Philippi, as the evangelistic team was headed (perhaps to the riverside) to pray, they encountered a slave girl who was possessed with a demon. Her owners used her as a "fortune-teller," though there is no real evidence that she could predict the future any better than those today who claim to possess such abilities. God would not have allowed the devil or his agents to work genuine miracles for this would confuse people in regards to God's miracles worked by the apostles and others. A primary function of miracles is to give validity to the speaker's message. One could know a message was both truth and from God if the speaker could work great signs. But, such would not be the case if the devil was permitted to employ miraculous powers also. So, although her powers of divination were based on clever deception, the evil spirit inside her, however, certainly was aware of God's servants and the power they wielded, both in word and deed. The demon used the girl repeatedly to proclaim, "These men are the servants of the Most High God, who proclaim to us the way of salvation." These words were true, yet, after several days, they annoyed Paul. Why? There are two likely reasons: (1) Her outcries were an interruption to Paul's teaching, and (2) It was not God's will that the forces of Satan be used as spokesmen for God. If Paul had perpetually ignored the proclamations of the evil spirit, eventually his reputation (as well as other Christians) would have been damaged. Paul proceeded to have mercy on the woman and cast out the demon by the name of Jesus Christ. The evil spirit immediately complied.
There was a negative financial consequence to this exorcism, however. The owners of the slave girl knew their money-making scheme was over. Without the demon inside of her, she was no longer useful as a "fortune-teller." No doubt she was restored by Paul to a proper state of mind, being no longer enslaved by the demon and perhaps less dominated by her earthly masters. These masters retaliate against Paul and Silas by forcing them to come with them before the authorities (when you hurt a man's pocketbook, you are on dangerous ground!). They stir up the people against the evangelists, using trumped-up charges that had little to do with their real complaint, in a similar fashion as the religious elite did to Jesus before His death. The authorities rip off the garments of the two innocent men and then command that they be beaten with rods. This is the first recorded example of Gentile persecution against the church. Both men suffered many stripes (cf. II Cor. 11:25). Although the Jews were limited to forty stripes, the Romans had no such limit. Paul and Silas--severely beaten, bruised, and bleeding--were then thrown into the inner prison with their feet in stocks (cf. II Tim. 3:12). They were held securely until midnight, but then something incredible happened!