This is a popular question asked by skeptics and Christians alike. In my opinion, I think the question is making some untrue assumptions about God and about people. The first false assumption is that the gospel of Jesus Christ has not made it to every corner of the globe. The next assumption is that God’s word can’t reach every person before they die. That ties into another assumption that God isn’t capable of telling certain people about himself and Jesus before those particular individuals die.
There are several places in the Bible that tell us God has made and is able to make himself known to everyone even if they live in a godless or idolatrous environment. That’s the message he first proclaimed in Genesis. Noah preached righteousness in the midst of the ungodly (2 Pet. 2:5) and most likely spoke of a coming Messiah to them before the flood. Abram (aka Abraham) was a pagan living among pagans when God personally called him and Sarai (aka Sarah) out of their idolatry (Josh. 24:2-3).
Centuries later, Isaiah prophesied that the Messiah would be a light not only to Jews, but to Gentiles everywhere in every era:
And he said, It is a light thing that thou shouldest be my servant to raise up the tribes of Jacob, and to restore the preserved of Israel: I will also give thee for a light to the Gentiles, that thou mayest be my salvation unto the end of the earth. Isa. 49:6
Fast forward to the early years of the New Testament and we find that God personally told an unknown number of Magi (aka “wise men”), pagans in pagan lands of Eastern Asia, that he sent them a Messiah who would save them. They believed God like Abraham did and followed his star to Bethlehem to worship him, forsaking their false gods and returning to their homelands. There is even proof that they may have preached the gospel because illustrations depicting stories from the Bible dating back to the 1st century have been found in China.
There is now overwhelming historical evidence that the gospel reached every Gentile by the end of the 1st century AD, thanks to the Roman trade infrastructure that stretched as far away as the British Isles to Africa to the farthest reaches of Asia. In our times, there have been reports of people in parts of the pagan world who have been introduced to the Messiah in dreams and visions, just as God promised he would do in Joel 2. It’s clear from John 14:6 and Acts 4:12 that no one gets into heaven without going through the Messiah. We know based on Paul’s words in Rom. 1:17-20 that all men everywhere will be given the opportunity to get saved before they die, “so that they are without excuse” for not believing in him.
Therefore, we can conclude that at this late date in world history, there is really no such thing as anyone not having the opportunity to believe in Jesus before their death. The question is moot and the unbelievers who ask it are just looking for any excuse to scoff at God, his word, and his people when they really have no valid standing. The Christians who ask it haven’t been educated about what has transpired in history.
Am I a God at hand, saith the Lord, and not a God afar off? Jer. 23:23
And ye shall seek me, and find me, when ye shall search for me with all your heart. Jer. 29:13