God did miracles in all their lives.
First they were singing and praying, all will have heard that. They knew about Paul.
Second a huge earthquake shook the foundations
Third, all doors opened
Fourth all chains came off the prisoners
Fifth, prisoners did not run away
Those were events that convicted them in their hearts that God had visited them and cared about them too.
If the prisoners had fled, the Romans would have killed the jailer and his family or sold the family into slavery. They would have been blamed and held accountable.
The jailer's family were living there with the jailer, they would have experienced all of that.
The promise of their salvation Paul saw by these miracles God was going to save them having changed all their hearts.
Paul and Silas then preached to them all the gospel.
And they were saved.
25 But at midnight Paul and Silas were praying and singing hymns to God, and the prisoners were listening to them. 26 Suddenly there was a great earthquake, so that the foundations of the prison were shaken; and immediately all the doors were opened and everyone’s chains were loosed. 27 And the keeper of the prison, awaking from sleep and seeing the prison doors open, supposing the prisoners had fled, drew his sword and was about to kill himself. 28 But Paul called with a loud voice, saying, “Do yourself no harm, for we are all here.”
29 Then he called for a light, ran in, and fell down trembling before Paul and Silas. 30 And he brought them out and said, “Sirs, what must I do to be saved?”
31 So they said, “Believe on the Lord Jesus Christ, and you will be saved, you and your household.” 32 Then they spoke the word of the Lord to him and to all who were in his house. 33 And he took them the same hour of the night and washed their stripes. And immediately he and all his family were baptized. 34 Now when he had brought them into his house, he set food before them; and he rejoiced, having believed in God with all his household.