Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
Allah is The Most Compassionate, The Oft-Forgiving, The Most Benevolent and The Most Clement. Allah has The Absolute Justice and The Unlimited Wisdom.
Since, He is characterized by the aforementioned Attributes, Allah does not punish anyone until that person hears about the religion and until the revelation reaches him/her. Now, if the revelation reaches a person, he/she will be held accountable for all his/her acts.
Allah Says (interpretation of meaning): {…And We never punish until We have sent a Messenger (to give warning).}[17:15].
For the person whom the revelation did not reach and he/she was not called to the right religion in this Duniya (this world) and who did not hear of the Messengers and Prophets, he/she will be tested on the Day of Judgement. If he/she obeys Allah, he/she goes to Paradise, otherwise he/she is thrown in Hellfire.
Allah knows best.