God created the world, and established the covenant of works (Genesis 2:16&17) with man. The requirements of this covenant were: man could eat of any tree in the Garden of Eden except for the tree of the knowledge of good and evil. If he did so, he would die. His relationship with God would be broken and he would struggle with sin for rest of his life.
Man shattered his end of the covenant, consequently falling into sin (Genesis 3). The perfect relationship he had with God was severed. Because Adam and Eve fell, all man is now dead in sin. We are completely insufficient, dependent and utterly unable to do any good in our own strength. We all deserve God's punishment and wrath for eternity.
However God, in His grace and mercy has another plan. This plan is called the covenant of grace (Genesis 3:15). God promised Adam and Eve, and through them all man, that He would send a mediator. A mediator who would be sent to come between Himself and man, taking the punishment for man's sin. This Mediator is Jesus Christ, the Son of God. If man believes in Christ, seeing himself as a worthless sinner in the sight of God, and seeing Christ as Savior, man is free from this curse of sin. Christ takes the blame, the guilt, and the sin. He came to die, so that we can be set free.
As a sign of this covenant to Abraham, God instituted circumcision (Genesis 17). All male children were to be circumcised as a reminder that they, as children of believers hoping in a coming Christ, were under this covenant. They were given the same promise as their parents were, and even though they could not understand it yet, they had a responsibility to believe in the coming Christ as Savior from sin as they became older. Parents had the same responsibility to believe, but also to teach their children about the coming Christ.
Years later, Christ did come. He overcame sin and death. He won the victory over Satan, so that we may be free from the wrath and punishment of sin. As New Testament believers we believe in a Christ who has come. We are not looking at shadows of what is to come; we can clearly see the glory of Christ's redemptive work.
The Covenant of Grace lives on between the Father and His people. The Covenant Promise continues to be given to children when they are conceived. The outward sign has changed (circumcision), and no longer holds significance, just as the ceremonial sacrifices. Nevertheless, God comes to us with the same promise (Acts 2: 38&39). Children of those who have taken hold of the promise and believe, are given the sign of baptism. Those who have been baptized have the great responsibility to plead upon that promise, and believe in Christ as our Savior from sin. God has promised to save those who believe from sin, and He will not forsake it.
The baptism of infants flows directly out of the Covenant of Grace. God comes to us while were are still sinners and promises salvation through Christ if we believe. This was signified in the Old Testament through circumcision and continues on throughout the ages; signified through the baptism of infants.
