True, Pharaoh had hardened his own heart often enough (Ex. 7:13,22,8:11,15,28; 9:7,34). But it seems that after a while the king had lost his freedom of action. He had no choice. His heart was hardened for him whether he liked it or not.
But there is a moral problem here. How could God bring punishment upon the Egyptians for doing something that He himself compelled them to do?
Maimonides, in the final section of his “Eight Chapters”, says, “Pharaoh and his followers, already of their own free will without any constraint whatsoever, had rebelled by oppressing the strangers who were in their midst, having tyrannised them with great injustice.”
The sin of the Egyptians had been to mistreat, enslave and degrade the Israelites, and no-one had forced them to do so.
Their punishment, according to Maimonides, began with the hardening of Pharaoh’s heart: “The punishment which God inflicted upon them was that He withheld from them the power of repentance, so there should befall them the punishment which justice required should be meted out to them… It would have been impossible to punish them if they had repented; therefore repentance was withheld from them”.
Though our belief, as expressed in the Yom Kippur prayer book, is that “up to the day of a person’s death God waits for them to repent”, there are some sins that compound to such an extent that in the end repentance is not possible.