This is a very upsetting subject. Although I have never lost an unborn child, I’ve seen the trauma and sorrow experienced by those who have and I extend my sincere sympathy to those who have experienced this loss.
Firstly, it is a common misconception that people go to heaven when they die. The Bible is very plain on this point. Heaven is not the reward offered to the faithful. Earth is where the faithful will live at the return of Jesus when he resurrects the faithful dead and gives them immortality. Consider the following Bible passages:
No one has ascended into heaven except he who descended from heaven, the Son of Man.
May the LORD give you increase, you and your children! (15) May you be blessed by the LORD, who made heaven and earth! (16) The heavens are the LORD’s heavens, but the earth he has given to the children of man. (17) The dead do not praise the LORD, nor do any who go down into silence.
1 Corinthians 15:20-23
But in fact Christ has been raised from the dead, the firstfruits of those who have fallen asleep. … (22) For as in Adam all die, so also in Christ shall all be made alive. (23) But each in his own order: Christ the firstfruits, then at his coming those who belong to Christ
The stark reality is that all who die cease to exist until the resurrection. This is not a bad thing. In God’s love and kindness, he has planned it this way. Those who die, know nothing. They experience no pain or suffering. Those who are faithful will rise again. See the following posts in relation to children: Will all children go to heaven? and What is the fate of children who die?