In order to be baptized, a person must willingly decide to follow God at all costs. If they are not willing to do what they sincerely view to be the ideal, in all situations, they are not prepared to be baptized.
As should be obvious, children should not be baptized unless they are mature enough to make an independent commitment to follow God at all costs (see Moroni 8). Babies are obviously incapable of making a covenant with God, but even if they were, there would be no point. Because they are unable to make moral decisions, they are incapable of sin, and because the atonement of Jesus Christ pays the price of the sin of Adam, young children are in no need of repentance. It greatly displeases God when people who profess belief in him baptize little children, because it demonstrates an abject ignorance of the gospel of Jesus Christ and the purpose of this life.