Allah will not wrong such people; rather, He will test them on the Day of Judgment.
People who did not have an opportunity to know Islam well have no excuse because, as we mentioned, they should not have been negligent in searching for the truth and thinking about it, although it is difficult to verify the act of informing people of Islam beyond ignorance and doubt since people vary. The destiny of those who are excused for their ignorance or for not being provided with irrefutable proof will be decided by Allah in the Hereafter, whereas the rulings related to this worldly life depend on what is apparent.
Allah's judgment to punish them is not injustice after all such irrefutable proofs that He provided them with through the mind, the natural disposition, the messages, and the signs in the universe and in their own selves. The least they were expected to do in return for all this was to know Allah Almighty and worship Him alone with adhering to the pillars of Islam at least. Had they done this, they would have been saved from eternity in Hellfire and would have attained happiness in this life and in the Hereafter. Do you think this is difficult?
The right of Allah Almighty over His slaves whom He created is to worship Him alone, and the slaves' right over Allah is that He does not punish those who do not associate anything with Him. It is very simple, only words that man must say, believe in, and act upon and this will be sufficient to save him from Hellfire. Is this not justice? This is Allah's judgment and He is the Judge, the Just, the All-Subtle, and the All-Aware, and this is His religion.
The real problem is not the fact that man errs or sins because making mistakes is part of man's nature, as all the children of Adam are sinners and the best of the sinners are those who frequently repent, as the Prophet (may Allah's peace and blessings be upon him) told us. The real problem; however, lies in exceeding the limits and insisting on committing sins. Besides, when one is offered an advice, he does not listen to it or apply it, and when reminded, he does not benefit from the reminder, and when admonished, he does not learn his lesson, repent, or ask for Allah's forgiveness; rather, he insists and turns away in arrogance.
{When Our verses are recited to him, he turns away in arrogance, as if he did not hear them, as if there were deafness in his ears. So give him tidings of a painful punishment.} [330] Surat Luqmān: 7.