There is no biblical record of baptism, as such, in the Old Testament, but history records instances or incidents where similar ceremonies were performed with similar objectives in view, so it was not a completely foreign idea when John the Baptist came with his message. The same angel, Gabriel, announced the expected birth of John the Baptist, and then foretold the birth of Jesus. The first two chapters of Luke tell the story. In order to repent we have to acknowledge that we are sinners. If we repent, we confess.
Baptism is a sign of that cleansing.
The visible sign is the water or baptism, while the invisible is the Spirit or the effect of the blood of Jesus applied to the heart and life, which should result in the fruit of the Spirit. See also Gal. Baptism publicly acknowledges that a person has taken a stand for Christ, just as the wedding is a public proclamation and legalizes the union of two people. The invisible part of the marriage relationship is their personal relationship to each other. Another thought on the Spirit is that when a person accepts Christ and is baptized, or is ready to be baptized, he can also receive the baptism of the Holy Spirit.