The Torah attests that G-d hardened Pharaoh’s heart, effectively causing him not to free Bnei Yisrael from slavery until G-d inflicted upon him the Ten Plagues.
The hardening of Pharaoh’s heart was in fact punishment for his prior sins. As the Rambam (Hilchos Teshuvah 6:3) explains, “It is possible for a person to commit a sin so egregious, or to commit so many sins, that the judgment rendered before the True Judge is that his retribution for these sins, which he committed freely and of his own accord, is that he is prevented from repenting and is no longer able to abandon his evil ways—so that he dies and perishes on account of those sins he committed.”
This explains why G-d did not give Pharaoh a chance to repent and avoid punishment for his previous wrongdoings. We find, however, that even after hardening Pharaoh’s heart, G-d warned him, “If you refuse to let My nation go, behold, tomorrow I will bring locusts into your borders” (Shemos 10:4)—as punishment for his current refusal to free Bnei Yisrael. How could Pharaoh be liable for decisions he made after G-d took away his freedom of choice?
Evidently, even after Pharaoh’s heart was hardened, he still had the option of changing his ways, and he was therefore punished when he did not. Support for this can be found in the Tanya. The Alter Rebbe writes in Tanya (Iggeres Hateshuvah, Chapter 11) about the Talmud’s statement that certain sinners are not granted a chance to repent, “This means only that he [the sinner] is not granted an opportunity. But if he presses forcefully and overpowers his evil impulse and repents, then his repentance is accepted.”
By the same token, even after G-d directly influenced Pharaoh’s feelings against freeing Bnei Yisrael, the ultimate decision of whether to free them or not was still Pharaoh’s to make, making him liable for actually refusing to do so.
From here we see that hope is never lost for a person to repent. On the contrary, the obstacles a Jew encounters in his path to repentance are intended to arouse in him even greater determination to “force” his return to G-d. Moshiach NOW!!!