A spirit of divination is a devil spirit. It is a spirit that possesses. This woman was involved in fortune telling. Just like the psychic hotlines and fortune tellers of our day, a spirit that is familiar with people and circumstances possesses a person and provides information that is accurate (to a point) to entice people to listen in order to bring financial gain and turn those who would believe away from God and His Word.
This spirit, speaking through the woman, was saying the truth that Paul, Silas, Luke and Timothy were servants of God who were bringing a knowledge of salvation to those who heard them. But the spirit was proclaiming this information to interfere with the ministries of these men of God and bring gain to the woman it was possessing and to her masters.
Paul became grieved with this woman following them around and with the spirit that was possessing her. The word grieved means "to be worn out with annoyance." Paul finally had had enough and, with guidance from God, cast the spirit out of the woman. Without the spirit possessing her, the woman could no longer give people information about themselves or others. She was no longer worth anything to her employers who had used her "supposed" ability for profit. Gain drove them and they saw that they were going to lose money on this deal. Therefore, they caught Paul and Silas and brought them to the rulers of the city to have them beaten and jailed.
Acts 16:22-25
And the multitude rose up together against them: and the magistrates rent off their clothes, and commanded to beat them.
And when they had laid many stripes upon them, they cast them into prison, charging the jailor to keep them safely:
Who, having received such a charge, thrust them into the inner prison, and made their feet fast in the stocks.
And at midnight Paul and Silas prayed, and sang praises unto God: and the prisoners heard them.
Once again the record demonstrates how the Apostle Paul (and Silas) were willing to sacrifice their own rights and freedoms to see God's Word live. They could have stopped this beating and jailing at any time simply by saying, "We are Roman citizens!" Paul and Silas were Roman citizens and in a Roman colony such as Philippi, it was illegal to beat a Roman citizen. Citizens had the right to trial and could even appeal a decision to Rome before punishment could be administered. Although the record does not tell us, God must have told Paul to allow this jailing for he could have stopped it at any time.
Paul and Silas were put into solitary (the inner prison) and their feet were locked in stocks to keep them secure. At midnight Paul and Silas cried about their miserable condition - Didn't they? NO! They prayed and sang praises to God. Moving God's Word and walking with God is absolutely not dependent upon the outward conditions or circumstances in which we find ourselves. Some look at the circumstances around them to determine if they are in line with God's Will rather than focusing their attention upon the Word of God. Paul and Silas were beaten and locked up! Yet, they were out moving the Word, praying and singing praises to God.
"And the prisoners HEARD them" - The others in prison heard Paul and Silas singing in the inner prison. They were not singing quietly to themselves. They were making a joyful noise unto the Lord. The other prisoners must have thought they were crazy!
Acts 16:26-34
And suddenly there was a great earthquake, so that the foundations of the prison were shaken: and immediately all the doors of the prison were opened, and every one's bands were loosed.
And the keeper of the prison awaking out of his sleep, and seeing the prison doors open, he drew out his sword, and would have killed himself, supposing that the prisoners had been fled.
But Paul cried with a loud voice, saying, Do thyself no harm; for we are all here.
Then he called for a light, and sprang in, and came trembling, and fell down before Paul and Silas,
And brought them out, and said, Sirs, what must I do to be saved?
And they said, Believe on the Lord Jesus Christ, and thou shalt be saved, and thy house.
And they spake unto him the word of the Lord, and to all that were in his house.
And he took them the same hour of the night, and washed their stripes; and was baptized, he and all his, straightway.
And when he had brought them into his house, he set meat before them, and rejoiced, believing in God with all his house.
The keeper of the prison usually lived in a house that was attached to the prison. This man (who is not named in the Word) believed and brought his whole household together to hear God's Word. First things first - Paul and Silas spoke God's Word to these people and they believed. As with Lydia, when the head of the household made a decision the rest of the household followed. The Word was spoken first, THEN they took care of the physical needs of Paul and Silas. The keeper took them into his house, washed their wounds and gave them food. AND rejoiced in the greatness of the Word of God!
Acts 16:35-39
And when it was day, the magistrates sent the serjeants, saying, Let those men go.
And the keeper of the prison told this saying to Paul, The magistrates have sent to let you go: now therefore depart, and go in peace.
But Paul said unto them, They have beaten us openly uncondemned, being Romans, and have cast us into prison; and now do they thrust us out privily? nay verily; but let them come themselves and fetch us out.
And the serjeants told these words unto the magistrates: and they feared, when they heard that they were Romans.
And they came and besought them, and brought them out, and desired them to depart out of the city.
The magistrates were afraid when they heard that they had beaten Roman citizens because the law was that if a Roman was beaten without a trial those who had beaten him should receive the same punishment. Paul and Silas could have appealed to have these magistrates beaten and jailed. Therefore, they came in person, brought them out of the prison, and begged them to leave in peace. As we saw earlier, Paul and Silas could have prevented the beating and jailing by letting the magistrates know at the time that they were Roman citizens. However, if they had not been jailed the keeper of the prison and his household would not have heard and believed God's Word.
Acts 16:40
And they went out of the prison, and entered into the house of Lydia: and when they had seen the brethren, they comforted them, and departed.
The pronouns have once again changed to "they" and "them" indicating that Luke is not leaving Philippi with them. His presence was last noted on the way to prayer when the devil spirit was cast out. Either he left the city during the time when Paul and Silas were in prison or he was now staying in Philippi with Lydia and the brethren. Paul, Silas and Timothy continued their journey and moved on to Thessalonica in Acts Chapter 17.