The issue of claiming ignorance as an excuse for not knowing or doing that which is correct is an important issue which scholars have differed about. The reason for the difference of opinion has to do with the level of accessibility of knowledge and being able to gain clarity on an issue by asking the people of knowledge.
Today with the advent of the internet, there is little room for claiming not to know by most people. The other issue regarding not knowing is as it relates to people who find out about a ruling but reject it. This constitutes pride and arrogance which could lead a person to punishment in the Hereafter. Imam ash Shafi’i said in regard to this category:
Allah has names and attributes that are mentioned in His Book, and of which His Prophet (blessings and peace of Allah be upon him) has told his ummah. No one to whom proof has been presented clearly can reject that, because they are mentioned in the Qur’an and are mentioned in saheeh reports from the Messenger of Allah (blessings and peace of Allah be upon him). Therefore if a person goes against that after clear proof has been presented to him, then he is a disbeliever. However, before clear proof has been presented to him, he may be excused for his ignorance, because knowledge of such matters cannot be figured out on the basis of reasoning or on the basis of reflecting and thinking. We do not deem anyone to be a disbeliever for not knowing it, except after knowledge thereof reaches him.
Imam ash Shafi’i
Siyar A‘laam an-Nubala’ (10/79)
The following two verses show clearly that acting in ignorance may be forgivable, however once knowledge has come to a person, the excuse for not knowing is removed. Allah said:
The repentance accepted by Allah is only for those who do wrong in ignorance [or carelessness] and then repent soon after. It is those to whom Allah will turn in forgiveness, and Allah is ever Knowing and Wise.
But repentance is not [accepted] of those who [continue to] do evil deeds up until, when death comes to one of them, he says, "Indeed, I have repented now," or of those who die while they are disbelievers. For them We have prepared a painful punishment.
Holy Quran
Surah An-Nisa (4:17-18)
Knowledge which is the opposite of ignorance is a characteristic of the learned. Allah praises those who have knowledge and act upon it by stating that they are the most God-fearing. They would not have attained that lofty station were it not that they were blessed with knowledge and action. Allah said:
Only those fear Allah, from among His servants, who have knowledge. Indeed, Allah is Exalted in Might and Forgiving.
Holy Quran
Surah Fatir (35:28)