However, if we look more into the matter we will find, in fact, a major claim against Pharaoh. For as was mentioned earlier, Hashem did not harden Pharaoh’s heart throughout the plagues; it was only at various times. The other times Pharaoh himself hardened his heart and refused to give in to suffering inflicted by the plagues. As per example by the plague of hail, the Torah relates: “And Pharaoh saw the rain and hail diminishing as well as the voices and he continued to sin and his heart, as well as the heart of his servants became heavy. And Pharaoh’s heart was hardened and he did not send the Children of Israel as Hashem told, into the hands of Moshe” (Shemos 9:34, 35). The Ibn Ezra relates over there that the verse mentions that now “he continued to sin” after he admitted ‘I have sinned this time,’ and it was clear what Moshe had said earlier: “And you and our servants I know that it is imminent that you will fear Hashem the G-D.” Yet, still, Pharaoh hardened his heart after this plague, more than the first ones. (Click here for Hebrew text.)
Meaning, Pharaoh himself, throughout the plagues, was very stubborn. And, even when he was about to give in, he buckled down and refused, and as a result of his unwillingness to cave in, “to add to his good and detract from his bad,” Hashem hardened his heart at other times and forced him to suffer the consequences. In fact the Ibn Ezra relates that when Hashem hardened Pharaoh’s heart after the plague of locust Hashem did this based on a gemara in Shabbos 104a, that one who comes to defile himself Hashem opens the doors to let it happen (Shemos 10:20). (Click here for Hebrew text)
In other words, Pharaoh was punished and caused himself to lose the right to have free will at all times. Hashem created man with a heart and mind receptive to Holy Wisdom from on High. The purpose of this wisdom is to do good and to stay away from bad. Hashem normally provides us with this Heavenly Wisdom to help us with our choices, to constantly grow; but it is all based on our free choice. But when Pharaoh chose to only use his free choice for evil, and to get worse and worse, he lost his opportunity to make his situation better for himself and his people, through his stubborn refusal to budge from his evil plight.
Hashem naturally helps a person to grow and stay away from bad. However we are
endowed with free choice and have the option to choose to go against nature. Pharaoh chose to lose his free will and let himself and his nation be contaminated by his stubbornness. For that he deserved his punishment.