“Moreover your little ones, which ye said should be a prey, and your children, which in that day had no knowledge between good and evil, they shall go in thither, and unto them will I give it, and they shall possess it” (Deut. 1:39).
In this passage, Moses is recalling Israel’s refusal to enter the Promised Land because of their fear and lack of faith in God. God punished the Israelites by having that generation die in the wilderness over a forty year period. The Promised Land is Israel’s hope; it is her heaven to be established on the earth (Deut. 11:21). Notice that God allowed the children of the unbelieving generation into the Promised Land, “which in that day had no knowledge between good and evil.” The children who had no knowledge of good and evil and had not partaken in Israel’s unbelief were spared, and they obtained the privilege of entering the Promised Land which their unbelieving parents had forfeited. This is a principle I believe is true today under grace, that God allows children in His heaven, who have no knowledge of good and evil and are before the age that they can trust Christ as their Savior.
The Scriptures call children who die “innocents” (Jer. 19:4-5). The Hebrew word translated as “innocents” means guiltless, to be taken to court and found not guilty. This does not mean that children are not fallen. It does not mean that they are not born into sin or have a sin nature. It does mean that God treats them mercifully as innocent. As such, by grace and the blood of Christ, babies are safe and God allows the innocents into His heaven when they die.
“And he said, While the child was yet alive, I fasted and wept: for I said, Who can tell whether God will be gracious to me, that the child may live? But now he is dead, wherefore should I fast? can I bring him back again? I shall go to him, but he shall not return to me” (2 Sam. 12:22-23).
When David’s son from his sin with Bathsheba was ill, David fasted and wept in his sorrow. After the baby died, David rose up, worshipped the Lord, and ate (2 Sam. 12:20). He explained to his servants the reason why was that “I shall go to him.” David had confident anticipation and the joyful hope of a reunion with his son. For believing parents who have lost babies to death, there is the certain hope of one day meeting them in heaven. source