The fate of unbaptized children is entrusted to the mercy of God.
1257 The Lord himself affirms that Baptism is necessary for salvation. He also commands his disciples to proclaim the Gospel to all nations and to baptize them. Baptism is necessary for salvation for those to whom the Gospel has been proclaimed and who have had the possibility of asking for this sacrament. The Church does not know of any means other than Baptism that assures entry into eternal beatitude; this is why she takes care not to neglect the mission she has received from the Lord to see that all who can be baptized are "reborn of water and the Spirit." God has bound salvation to the sacrament of Baptism, but he himself is not bound by his sacraments.
1261 As regards children who have died without Baptism, the Church can only entrust them to the mercy of God, as she does in her funeral rites for them. Indeed, the great mercy of God who desires that all men should be saved, and Jesus' tenderness toward children which caused him to say: "Let the children come to me, do not hinder them,"63 allow us to hope that there is a way of salvation for children who have died without Baptism. All the more urgent is the Church's call not to prevent little children coming to Christ through the gift of holy Baptism.
"The Second Vatican Council stated, "For since Christ died for all (Rom. 8:32) . . . we must hold that the Holy Spirit offers to all the possibility of being made partners, in a way known to God, in the paschal mystery" (Gaudium et Spes 22). This includes the young and those severely retarded.
"Some have speculated about what form God's offer of salvation might take to children. One suggestion is that he might enlighten them at the moment of death and enable them to make a choice for or against him. This possibility was endorsed by the nineteenth-century Catholic theologian Heinrich Klee.
Another suggestion is that these persons may have a form of "baptism of desire" through the desire of their parents, of the Church, or of someone else. This would operate the way the faith of the Church suffices to allow infants to be baptized, even though they lack faith themselves. This idea ("vicarious baptism of desire") was endorsed by Cardinal Cajetan at the time of the Reformation."
This Rock, Nov. 1994, Quick Questions column
Oct. 6, 2004 International Theological Commission on fate of
unbaptized children.
Baptized babies who die (before the age of reason) will go directly to heaven.
1263 By Baptism all sins are forgiven, original sin and all personal sins, as well as all punishment for sin. In those who have been reborn nothing remains that would impede their entry into the Kingdom of God, neither Adam's sin, nor personal sin, nor the consequences of sin, the gravest of which is separation from God.
Further reading:
Catechism of the Catholic Church Sections 1213-1284
Baptismal Grace
Infant Baptism
Do Aborted Babies Go To Heaven?