It's not that if you don't hear you will be saved, it's that those who have not heard and yet recognize the law written in their heart may have Christ reveal himself to them.
As an analogy:
There is a low meadow with 1,000 sheep grazing by a river. During a dark night, a storm rises up and the field starts to flood. There is a narrow path up to a higher spot, but in the darkness and confusion, the sheep can't find it. One or two might if they are close enough and can stumble their way up in the darkness, but the rest will perish.
Now if a shepard was to appear with a lamp and show them the path and lead them, many more will be saved.
Those who have not had the opportunity to hear the Gospel are living in the low meadow with the river rising. Some might find the right path, but most will perish. A Missionary is the shepard sent with the light. More will be saved than before when he arrives. But to say that the one or two who stumble across the path cannot be saved is to claim that God is not sovereign and cannot bring salvation to whom he will.
And just who who does not believe can follow the law?
Jesus fulfilled the law for us.
Somebody who just believes in God doesn't have that, and therefore still stands condemned in the eyes of a just God.