About this time King Herod began to persecute some members of the church.
He had James, the brother of John, put to death by the sword.
When he saw that this pleased the Jews, he went ahead and had Peter arrested. (This happened during the time of the Festival of Unleavened Bread.)
After his arrest Peter was put in jail, where he was handed over to be guarded by four groups of four soldiers each. Herod planned to put him on trial in public after Passover. 1
References for Acts 12:4
12.4 Ex 12.1-27.
So Peter was kept in jail, but the people of the church were praying earnestly to God for him.
The night before Herod was going to bring him out to the people, Peter was sleeping between two guards. He was tied with two chains, and there were guards on duty at the prison gate.
Suddenly an angel of the Lord stood there, and a light shone in the cell. The angel shook Peter by the shoulder, woke him up, and said, "Hurry! Get up!" At once the chains fell off Peter's hands.
Then the angel said, "Tighten your belt and put on your sandals." Peter did so, and the angel said, "Put your cloak around you and come with me."