Rambam: Shemot: Barriers to Teshuva
Hilchot Teshuva 6:3: A person may commit a great sin or many sins causing the judgment rendered before the True Judge to be that the retribution administered to this transgressor for these sins, which he willfully and consciously committed, is that his Teshuva will be held back.
He will not be allowed the chance to repent from his wickedness so that he will die and be wiped out because of the sin he committed.
This is implied by God’s declaration, related by Isaiah, “Make the heart of this people fat, and make their ears heavy. Smear over their eyes, lest they see with their eyes…understand with their hearts, repent and be healed.” (Isaiah 6:10)
Similarly the verse says, “They mocked the messengers of God, scorned His words, scoffed at His prophets until the anger of God mounted up against His people until there was no remedy. (Chronicles II 36:16)
Implied by these verses is that they willingly sinned, multiplying their iniquity until it was obliged to hold back their Teshuva, which is referred to as the “remedy.”
For these reasons, it is written in the Torah, “I will harden Pharaoh’s heart.” (Exodus 14:4) Since, he began to sin on his own initiative and caused hardships to Israel who dwelled in his land, as the verse states, “Come let us deal wisely with them.” (Exodus 1:10) Judgment obligated that he be prevented from repenting so that he would suffer retribution. Therefore, God hardened his heart.