The re-baptism of the eleven disciples from Ephesus was significant, as it points out the difference between the baptism of John and the baptism required after Christ's sacrifice on the cross. John's baptism was the one which was transitional, calling the people to repentance before the old covenant had been nailed to the cross (Matt. 3:2).
When Peter and the apostles were preaching on the day of Pentecost, a new covenant baptism for the remission of sins in the name of Christ was instituted, and there was no distinction called out for any that had already been baptized by John. They all had to be re-baptized in the name of Christ, and that would have also applied to the apostles. It is a matter of deduction that this must have been a universal requirement. Otherwise, Paul would not have made this distinction with the eleven disciples in Acts 19.
If the baptism of John was sufficient, Paul would have just proceeded with the laying on of hands to give them the gift of the Holy Spirit promised to that generation. That Paul even asked the question meant that he was in the habit of asking that question of the disciples as he came to them. The gift of the Holy Spirit was only made available after Christ's crucifixion (Acts 2:38-39), and was only available after the laying on of the hands of the apostles or one of their appointed presbyters (Timothy).
The gift of the Holy Spirit was promised to that generation for the miracles that confirmed the authority of the word from God, ie: prophesy, healing, speaking in foreign languages (tongues), etc. It was not a result of the baptism! If it was an automatic result of baptism, then Paul would not have had to lay hands on any of them after they were baptized in the name of Christ.
Notice what Paul tells Timothy in 1 Tim. 5:22,
"Lay hands suddenly on no man, neither be partaker of other men's sins: keep thyself pure."
The caution to Timothy was to be certain that the disciple was a true believer who had repented of his/her sins and had been baptized before he/she be given a gift of the Holy Spirit.
Many people confuse the promise of the gift of the Holy Spirit in Acts 2:38 to be an automatic result of baptism. But, they forget to read on to verse 39 which is connected by the conjunction "for."
" For the promise is unto you, and to your children, and to all that are afar off, even as many as the Lord our God shall call."
The promise was to them - those of the first century AD, to their children, and to those far off gentiles who had yet to be grafted in (Cornelius, Acts 10:25-48). The gift of the Holy Spirit aided in the authentication of the word of God because the gospels and epistles had not yet been written and were not yet in circulation.
"Ye men of Israel, hear these words; Jesus of Nazareth, a man approved of God among you by miracles and wonders and signs, which God did by him in the midst of you, as ye yourselves also know:"
The miracles of the Holy Spirit confirmed the word. Peter told them that what they were seeing and hearing on that Pentecost day in that first century AD was what the prophet Joel had told them would happen (Acts 2:16). Those gifts were for a special generation, and a special time to establish the gospel of Christ with authority in the hearts of the people.
So, when Paul came to the eleven disciples from Ephesus and learned that they did not know of any gift of the Holy Spirit, he knew they had not been baptized in the name of Christ.
The three exceptions to the sequence were those who had received the Holy Spirit before their baptism... the apostles on the day of Pentecost (Jewish believers, Acts 2); Paul at the house of Judas in Damascus(apostate and converted Jew, Acts 9:3-18); and the house of Cornelius (gentile).
As we know that both Paul and the house of Cornelius were baptized with water after the Holy Spirit fell upon them, then the baptism in the name of Christ was still required of them.
God is not a respecter of persons (Acts 10:34), therefore all are required to meet the same conditions:
"Repent and be baptized every one of you in the name of Jesus Christ for the remission of sins..." (Acts 2:38)
And some may say that baptism was of the Holy Ghost, and of fire, citing John's statement to the Pharisees and Sadducees in Matt. 3:11 -
"I indeed baptize you with water unto repentance. but he that cometh after me is mightier than I, whose shoes I am not worthy to bear: he shall baptize you with the Holy Ghost, and with fire: 12 Whose fan is in his hand, and he will throughly purge his floor, and gather his wheat into the garner; but he will burn up the chaff with unquenchable fire."
John was not speaking of their conversion. He was telling the unbelieving Pharisees and Sadducees of the fire of God's judgment that would fall on them for denying and crucifying the Messiah. The fire of God's wrath is judgment language from all OT prophesy, and John used it in Matt. 3 against that "generation of vipers". (See Ezek. 22:31; Jer. 21:12; Nah. 1:6)
" I am come to send fire on the earth; and what will I, if it be already kindled?"
Jesus used the same language that was used in all OT prophesy warning them of the judgment to come on that generation. (Matt. 3:10, Luke 3:9).
So, those disciples in Ephesus had to be re-baptized in the name of Christ before they could receive the promised gift of the Holy Spirit. The gifts of the Holy Spirit were for that special generation of the first century AD, and faded after the second appearance of Christ in AD 70 after the destruction of Jerusalem. As those of that generation died off, so did the miraculous gifts.
But the first part of the requirement of Acts 2:38 is still required of everyone.