The ideas of a ceremonial purification involving water were common in the First Century throughout many pagan religions, and certainly cleansing with washings and the use of water is found extensively in the Law of Moses (Lev 14-17). There were a number of reasons that one would need to be cleansed including skin infections, bodily discharges, contact with corpses, etc. In addition to this, the priests were to be washed before offering sacrifices.
We know that on at least one occasion, the Jews of Jesus’ day were critical of His disciples for not washing their hands prior to eating (Matt 15:2-9).
In the times of Christ, one became a proselyte (one converted to Judaism rather than being born into it) through submitting to circumcision (if male), being baptized (a ceremonial washing), and offering a sacrifice of atonement (International Bible Encyclopedia). It appears that Jesus may have been referring to the proselyte efforts on the part of His contemporary Pharisees in Matt 23:15.
We see the idea of being cleansed in water from sin begins in prophecy concerning the time of the Messiah.
Isa 1:16 NKJV] “16 “Wash yourselves, make yourselves clean; Put away the evil of your doings from before My eyes. Cease to do evil,”
[Zec 13:1 NKJV] “1 “In that day a fountain shall be opened for the house of David and for the inhabitants of Jerusalem, for sin and for uncleanness.”
So when we see John the Baptizer appear on the scene, we see him begin to have a message that was new to the Jews. [Mar 1:4-5 NKJV] “4 John came baptizing in the wilderness and preaching a baptism of repentance for the remission of sins. 5 Then all the land of Judea, and those from Jerusalem, went out to him and were all baptized by him in the Jordan River, confessing their sins.”
Prior to this, Jews dealt with sin through animal sacrifices alone. So when Jesus tells Nicodemus that he must be born again of water and Spirit, he in essence is telling this Pharisee that he must be baptized to see the kingdom of God (Jhn 3:5-7). So it is then that under Christ, all nations were being called to Jerusalem and being consolidated to God entering in through baptism and so the prophesy of the Messiah were confirmed and fulfilled (Isa 66:18, Jer 3:17).
John introduced the idea, Jesus taught on it, and by way of the great commission, instructed the Apostles that those who would come to Him must be likewise born again (Matt 28:19, Mk 16:16). So it was then on the Day of Pentecost that Peter instructed those who would be saved to “repent and be baptized” (Acts 2:38). Paul expounds on the connection of baptism to being made new, a regeneration (2 cor 5:14-17, Rom 6:3-9). Peter likens baptism to the salvation from sin that was granted to Noah in the waters of the flood (1 Pete 3:20-21).
The Hebrew writer told the Jews of the First Century that they should be washed from their sins and enter the Holiest as priests because of Jesus the High Priest. [Heb 10:19-22 NKJV] “19 Therefore, brethren, having boldness to enter the Holiest by the blood of Jesus, 20 by a new and living way which He consecrated for us, through the veil, that is, His flesh, 21 and [having] a High Priest over the house of God, 22 let us draw near with a true heart in full assurance of faith, having our hearts sprinkled from an evil conscience and our bodies washed with pure water.”
This is exactly what Paul tells Titus regarding the regeneration of baptism. [Tit 3:4-7 NKJV] “4 But when the kindness and the love of God our Savior toward man appeared, 5 not by works of righteousness which we have done, but according to His mercy He saved us, through the washing of regeneration and renewing of the Holy Spirit, 6 whom He poured out on us abundantly through Jesus Christ our Savior, 7 that having been justified by His grace we should become heirs according to the hope of eternal life.”
So we see that the Jews in Jesus day were familiar with washings, and the teaching of John the Baptist, Jesus, and the subsequent preaching of the Apostles were bringing Jew and Gentile alike to God via the washing of baptism. This is the new birth which Jesus taught Nicodemus and it is the birth that we today must go through in order to be granted entry into Christ and into the kingdom of Heaven.