Consequently, was baptism necessary for the Jews to be saved in Acts 2:38? Yes and no. Yes, in that it was a necessary expression of faith in response to the gospel, and no, in that the physical act itself had no saving power.
A helpful analogy is found in Romans 10:9–10. In this passage, the apostle Paul writes that one must confess Jesus as Lord with his mouth in order to be saved:
If you confess with your mouth Jesus as Lord, and believe in your heart that God raised Him from the dead, you shall be saved; for with the heart man believes, resulting in righteousness, and with the mouth he confesses, resulting in salvation (Rom 10:9–10).
In one sense, we face the same initial difficulty here in Romans 10:9-10 as we do in Acts 2:38—the straightforward reading of the text at least seems to indicate that one must respond to the gospel with some kind of external act in order to be saved. But is the actual movement of one’s lips necessary for one to be saved according to Romans 10? Yes and no. Yes, in that it was a necessary expression of faith in response to the gospel, and no, in that the physical act itself had no saving power. In terms of baptism in Acts 2:38, then, as F.F. Bruce writes, “the reception of the Spirit is conditional not on baptism in itself but on baptism as the expression of repentance.”
To illustrate, suppose there were three men standing together in the crowd on the Day of Pentecost. In response to Peter’s exhortation to repent and be baptized, the first man says, “I repent and believe in Christ,” and he truly does. So he gets in line, and he is baptized. This man is forgiven and receives the gift of the Holy Spirit.
The second man says, “I repent and believe in Christ,” and he also truly does. While he is in line to be baptized, however, he has a heart attack and dies. Is this man forgiven? Did he receive the gift of the Holy Spirit before he died? Yes, absolutely, because conversion is ultimately a matter of the heart. He truly repented and believed, and therefore He was truly forgiven. [Keep in mind Acts 10:44-48, where Cornelius and the other Gentiles were clearly regenerated by the Holy Spirit prior to be baptized in water.]
But the third man says, “I repent and believe in Christ,” and yet when it comes time to be baptized, he refuses to publicly declare his allegiance to Christ. Is this man forgiven? Did this man receive the gift of the Holy Spirit? No, because his refusal to be baptized in the name of Jesus reveals an unrepentant heart that is unwilling to believe in Christ and become His disciple.