"And it happened, while Apollos was at Corinth, that Paul, having passed through the upper regions, came to Ephesus. And finding some disciples he said to them, 'Did you receive the Holy Spirit when you believed?' So they said to him, 'We have not so much as heard whether there is a Holy Spirit.' And he said to them, 'Into what then were you baptized?' So they said, 'Into John's baptism.' Then Paul said, 'John indeed baptized with a baptism of repentance, saying to the people that they should believe on Him who would come after him, that is, on Christ Jesus.' When they heard this, they were baptized in the name of the Lord Jesus" (Acts 19:1-5).
Paul found some disciples (i.e., learners) when he came back to Ephesus. They had limited knowledge of Jesus and His ministry, as revealed by their answers to Paul's questions. Because they were disciples, Paul assumed that they had been baptized into Christ and had received the non-miraculous indwelling of the Holy Spirit (cf. Acts 2:38 and our archived lessons from 10/02/10 and 10/09/10 for an in-depth explanation of this). Thus, when Paul asked if they had received the Holy Spirit, he was asking if they had received God's Spirit in a way that enabled them to work miracles (cf. Acts 8:17). He wants to know if they had received miraculous power as a result of their believing (i.e., had an apostle already laid hands on them after they had obeyed the gospel?). Clearly, Paul was thinking that if they did not have the miraculous gifts yet, he--as an apostle--would lay hands on them to enable them to work miracles and further the work of the church in that area. However, when the disciples responded to Paul by telling him they knew nothing of a Holy Spirit, not only did he learn that they were not miraculously endowed by the Spirit, but he also realized they had not yet received Christian baptism! He deduced they could not been baptized "in the name of the Father and of the Son and of the Holy Spirit" if they didn't know whether the Holy Spirit even existed (Matt. 28:19)! Furthermore, since Christian baptism results in one receiving the gift of the Holy Spirit (i.e., the non-miraculous indwelling), and these disciples would have been taught that before they were baptized into Christ.
This caused Paul to further inquire - "Into what then were you baptized?" The answer: "Into John's baptism." Paul then explained that John's baptism pointed one to Christ. Although John's baptism had its place in pointing to the coming Christ, Christian baptism is grounded in the fact that the Christ has already come, died, and arose. Many were baptized by John in the Jordan River, but his baptism had been superseded by Christ's. These men, after being taught properly, were then baptized in the name of the Lord Jesus.
I believe there is a connection between what we learned about Apollo's teaching (prior to his meeting with Aquila and Priscilla) and these twelve men. Due to the fact that we have no record of others being baptized again who were immersed under John's baptism, this suggests that there was something unique about the baptism of John that was administered to these men--namely, they were baptized into John's baptism after it had already been replaced and was no longer valid. This is why we have a record of them being immersed again but not the apostles, who were also baptized into John's baptism (but it was still valid at the time). Some affirm the apostles were baptized once into John's baptism and then again later into Christian baptism. There is no evidence of this and there are several points against it. Primarily, if everyone who was baptized by John had to be baptized again later into Christ, the purpose of John's baptism would be greatly weakened. I believe the baptism of John was sufficient for those who submitted to it while it was in force (e.g., the apostles, Apollos, etc.), but for those who were baptized into after it had been replaced (e.g., like these twelve men) it was not sufficient and such ones were in need of Christian baptism. Apollos preached an outdated baptism, but it was valid when he submitted to it previously. But, John's baptism was obsolete when these men received it, which necessitated the need for them to be immersed correctly.