Baptism was a act of obedience for the newly converted, Peter knew these people had already been given repentance, a change of mind from Christ on High according to Acts 5:31
31 Him hath God exalted with his right hand to be a Prince and a Saviour, for to give repentance to Israel, and forgiveness of sins.
These people were guilty of wickedly crucifying Christ earlier but the Spirit regenerated them and gave them repentance Acts 2:23
23 Him, being delivered by the determinate counsel and foreknowledge of God, ye have taken, and by wicked hands have crucified and slain:
They had been made sorry for their wickedness by the Spirits work who had been poured out Vs 33
33 Therefore being by the right hand of God exalted, and having received of the Father the promise of the Holy Ghost, he hath shed forth this, which ye now see and hear.
They were now new creatures ready to be instructed and to follow Jesus Apostles Doctrine Vs 37
37 Now when they heard this, they were pricked in their heart, and said unto Peter and to the rest of the apostles, Men and brethren, what shall we do?
But you dont get it.