God relates to His people through covenant (a solemn agreement). When God established His covenant with Abraham, there was a sign of covenant given—circumcision. In the New Testament, God established a new covenant with us through Jesus, and baptism is the outward sign of our involvement in this covenant.
And in Him you were also circumcised with a circumcision made without hands, in the removal of the body of the flesh by the circumcision of Christ; having been buried with Him in baptism, in which you were also raised up with Him through faith in the working of God, who raised Him from the dead. Colossians 2:11–12
When God delivered His people Israel out of bondage in Egypt, they passed miraculously through the parted waters of the Red Sea. They passed out of slavery and into freedom and a new life. The chariots of Egypt were drowned in those same waters. This is a great picture of Christian baptism. When we trust in Christ, we are liberated from our bondage to sin and selfishness and set free to live the new resurrection life of Jesus. When we are baptized, we pass through the waters from slavery into freedom and our old life is destroyed—much like Pharaoh’s armies.
For I do not want you to be unaware, brethren, that our fathers were all under the cloud and all passed through the sea; and all were baptized into Moses in the cloud and in the sea. 1 Corinthians 10:1–2