To start, I am going to borrow the quote below:
Toward the beginning of the Christian era, the Jews adopted (as a custom unrelated to Divine guidance) the custom of baptizing proselytes seven days after their circumcision. A series of specific interrogations made it possible to judge the real intentions of the candidate who wished to adopt the Jewish religion. After submitting to these interrogations, he was circumcised and later baptized before witnesses. In the baptism, he was immersed naked in a pool of flowing water; when he rose from the pool, he was a true son of Israel. After their baptism, new converts were allowed access to the sacrifices in the Temple.
When John the Baptist came on the scene in the first century Jewish world, his teaching included the necessity of baptism. The people of his day were familiar with the act or practice of baptism as just discussed. However, John's baptism was not based on or authorized by the Jewish law or pagan religious customs and traditions. John was called to preach by God, armed only with the Word of God (Luke 3:2). Jesus tells us that the baptism that John taught was from heaven, not from men ( Matt 21:25). When John preached a baptism for the remission of sins, the people heard and obeyed. They submitted to the baptism that had been authorized by God. It was the first time in human history in which a person had the opportunity to be baptized for the remission of his sins, pagan and Jewish religious customs, notwithstanding. A necessary refinement in the administration of baptism had to be made following the death of Jesus, however, as Acts 19:1-7 points out. Rather than submitting to the baptism of John, which was a baptism of repentance, we can now be baptized into the name of the Lord Jesus.
As this indicates, there was a practice of water baptism in Jewish tradition in the late first century BC and the early first century AD. When John came baptizing, the people knew what he was talking about, and knew what baptism was (immersion: in this case in water) and was for: in John's case, to be associated with having a repentant heart and drawing closer to God.
So there was a traditional precedent for water baptism even before John. Jesus, in His perfect knowledge and divine planning (through the Holy Spirit) adopted baptism in water as the point in time in which a person's salvation is sealed and effected. It is when one is immersed in water that the Holy Spirit unites us with Jesus death and resurrection (Rom 6:3 and also see Col 2:11-14).