You are asking a question that is often asked and that fills us all with strong emotions. And perhaps the reason why it is so often asked is that the Bible does not explicitly give us an answer, and we then end up emotionally dissatisfied. We rejoice at every mention of people being baptized and receiving the promises of faith and forgiveness and hearing the gospel and being brought to trust Jesus and becoming citizens of heaven. We also grieve because so many in this world do not enjoy these blessings and feel particularly bad when we could not apply the gospel to some people like miscarried or stillborn children.
Regarding miscarried children we must affirm that they, like everyone else, were conceived in an inherited sinful condition and need forgiveness to be saved. We also affirm that Christ is the only revealed Savior for all mankind, regardless of the specific circumstances that prevail from person to person. On the basis of clear Scripture, then, we understand that they need faith in Christ and that faith in Christ is given by God through the Gospel. In saying this we do not wish to be understood as saying God could not create faith in people’s hearts aside from the gospel (recall the amazing work of the Holy Spirit with John the Baptist when he was still a fetus, Luke 1:41-44), or could not have devised other ways and means for doing it if he had seen fit to do so. We merely report that God throughout Scripture reveals that he works through the gospel to create faith and that this faith is necessary for personal salvation.
It would be presumptuous for us to assume that miscarried children are nevertheless headed for heaven. This idea is not based on Scripture. It is quite popular and emotionally pleasing, of course, and we fully understand the motives in adopting such a position. However, we bind ourselves to Scripture alone for doctrine and simply say that there are things we do not fully understand and cannot fully explain — and this subject is one of those. To say it bluntly, here we are in the realm of the unsearchable judgments of God. That is where we should leave this kind of speculation.
We are given the assurance that God is a compassionate God, whose judgments are fair. “The Lord is compassionate and gracious, slow to anger, abounding in love. . . . He does not treat us as our sins deserve or repay us according to our iniquities. For as high as the heavens are above the earth, so great is his love for those who fear him” (Psalm 103:8-11). We make this the basis of our convictions about what is fair or not fair; whatever God does is fair and right, and good. What “seems fair” to our limited minds and emotions is not to be made the standard of truth.
The way a person seeks to respond to a question like yours tells us a lot about how that person does theology. If we limit ourselves to Scripture alone, we do not have a lot to say. We will stress what God has graciously revealed to us and admit our limitations. And we will recommit ourselves to witnessing and the support of mission work. But if we are willing to manufacture other answers that strike us as reasonable or emotionally satisfying, lots of ideas are possible. I sincerely pray that we never take that route, but commend these issues to the gracious Lord who will answer our questions when we get to glory. “For we know in part and we prophesy in part, but when perfection comes, the imperfect disappears. When I was a child, I talked like a child, I thought like a child, I reasoned like a child. When I became a man, I put childish ways behind me. Now we see but a poor reflection as in a mirror; then we shall see face to face. Now I know in part; then I shall know fully, even as I am fully known.” (1 Corinthians 13:9-12).