Is ignorance of the law a defence? Well, yes and no.
In the English-speaking world, no, it isn’t, mostly. (See, for example, this clause out of Queensland’s (Australia) criminal code.) If the law has been made, you’re expected to know about it.
So it was with Israel: the Law was made, and God expected the Israelites to know about it:
Deuteronomy 29:29 The Lord our God has secrets known to no one. We are not accountable for them, but we and our children are accountable forever for all that he has revealed to us, so that we may obey all the terms of these instructions.
God still has things He hasn’t told us or anyone else. Those things aren’t our problem, and they weren’t the Israelites’ problem either.
We are responsible for what we do know, or what we should know. Ezekiel was told this when God made him a watchman for Israel, in his efforts to have them choose righteousness:
Ezekiel 33: 7-9 Now, son of man, I am making you a watchman for the people of Israel. … If I announce that some wicked people are sure to die and you fail to tell them to change their ways, then they will die in their sins, and I will hold you responsible for their deaths. But if you warn them to repent and they don’t repent, they will die in their sins, but you will have saved yourself.
This didn’t die with Jesus. We’re still accountable to God for what we know. Talking to the Pharisees, who knew the law and the scriptures inside out, Jesus said:
John 9:41 If you were blind, you wouldn’t be guilty … But you remain guilty because you claim you can see.
This responsibility for what we do know didn’t die with Jesus. James tells us:
James 4:17 Remember, it is sin to know what you ought to do and then not do it.