what does the bible say?
In the early church, it was unheard of for a believer to not be baptized right after salvation (see Acts 8:36, 38). Indeed, perhaps the only recorded case of an exception is the thief on the cross in Luke 23:39–43. While that exception proves the testimony of Scripture that faith is all that is required for salvation, the fact believers were assumed to be baptized believers shows how closely faith and baptism were related. In that way, they took Jesus’ final command seriously to baptize and teach disciples (Matthew 28:19–20; c.f., Acts 2:37–38). That assumption of all believers being baptized believers allowed authors like Peter to talk about baptism as connected with salvation.
In the immediate context, the people who heard Peter’s sermon had been deeply convicted of their sin. Peter was answering a question about what they should do now, to which Peter said that they should repent and be baptized. Greek grammar indicates that the focus of “repent” and “baptized” was different, with repentance being to them all, but “baptized” being directed to each who repented. Likewise, the rest of Acts, and Scripture as a whole, teaches that it is faith, alone, that brings salvation (Acts 10:43, 16:31, Ephesians 2:8–9, John 1:12, and so forth).