That’s a good question. A really good question. I’m not sure that I or any person has the full answer, but here is how I understand it.
First of all, God is love and God is just. No one who should be in heaven will miss the opportunity. That is an absolute fact.
Second, a person must put h/her trust in Jesus for salvation
Third, God is the one who initiates that belief.
On the other hand, God has decided where each and every person will live during h/her lifetime. He knows who will or will not accept His offer of salvation so . . .
Atheists like to mock Christians for being born into a Christian family. In the atheist mind this somehow negates the possibility of a real conversion. Well, they can mock if they want but they're simply confirming what God has already determined.
Besides that, we are told in Romans 2:12-15 that all of us know the “law” in our heart of hearts. We know whether we are wilfully disobeying our conscience. We are also told that:
. Through the existence of the universe, everyone on the planet has enough evidence of God's existence to explore for His reality further. “If you search diligently for Me, I will allow myself to be found by you.”
. The more we obey God the more of Himself / Jesus He reveals to us.
Abraham, Noah, Rahab etc. none of these people knew Jesus, but they believed God and were counted as righteous because of the way they responded to the knowledge of God (however little) that they did have.
Again, God is just. God is love. We can trust that anyone who would like a healed and forgiven relationship with h/her Creator will have that kind of relationship.