John 3:1-8 NKJV There was a man of the Pharisees named Nicodemus, a ruler of the Jews. (2) This man came to Jesus by night and said to Him, "Rabbi, we know that You are a teacher come from God; for no one can do these signs that You do unless God is with him." (3) Jesus answered and said to him, "Most assuredly, I say to you, unless one is born again, he cannot see the kingdom of God." (4) Nicodemus said to Him, "How can a man be born when he is old? Can he enter a second time into his mother’s womb and be born?" (5) Jesus answered, "Most assuredly, I say to you, unless one is born of water and the Spirit, he cannot enter the kingdom of God. (6) "That which is born of the flesh is flesh, and that which is born of the Spirit is spirit. (7) "Do not marvel that I said to you, ‘You must be born again.’ (8) "The wind blows where it wishes, and you hear the sound of it, but cannot tell where it comes from and where it goes. So is everyone who is born of the Spirit."
St. Justin Martyr (155 AD) demonstrates that the early Christians understood Jesus’ words to Nicodemus in John 3 as referring to the sacrament of baptism.
“Through Christ we received new life and we consecrated ourselves to God. I will explain the way in which we did this. Those who believe what we teach is true and who give assurance of their ability to live according to that teaching are taught to ask God’s forgiveness for their sins by prayer and fasting and we pray and fast with them. We then lead them to a place where there is water and they are reborn in the same way as we were reborn; that is to say, they are washed in the water in the name of God, the Father and Lord of the whole universe, of our Savior Jesus Christ and of the Holy Spirit. This is done because Christ said: Unless you are born again you will not enter the kingdom of heaven, and it is impossible for anyone, having once been born, to re-enter his mother’s womb.
An explanation of how repentant sinners are to be freed from their sins is given through the prophet Isaiah in the words:
Wash yourselves and be clean. Remove the evil from your souls; learn to do what is right. Be just to the orphan, vindicate the widow. Come, let us reason together, says the Lord. If your sins are like scarlet, I will make them white as wool; if they are like crimson, I will make them white as snow. But if you do not heed me, you shall be devoured by the sword. The mouth of the Lord has spoken.
The apostles taught us the reason for this ceremony of ours. Our first birth took place without our knowledge or consent because our parents came together, and we grew up in the midst of wickedness. So if we were not to remain children of necessity and ignorance, we needed a new birth of which we ourselves would be conscious, and which would be the result of our own free choice. We needed, too, to have our sins forgiven. This is why the name of God, the Father and Lord of the whole universe, is pronounced in the water over anyone who chooses to be born again and who has repented of his sins. The person who leads the candidate for baptism to the font calls upon God by this name alone, for God so far surpasses our powers of description that no one can really give a name to him. Anyone who dares to say that he can must be hopelessly insane.
This baptism is called “illumination” because of the mental enlightenment that is experienced by those who learn these things. The person receiving this enlightenment is also baptized in the name of Jesus Christ, who was crucified under Pontius Pilate, and in the name of the Holy Spirit, who through the prophets foretold everything concerning Jesus.”
First Apology (chapter 61)