Active or Passive Hardening
To understand this, we have to distinguish between active hardening and passive hardening. What we have in this verse is an example of Gods punitive judgment against a wicked man. Pharaoh was already wicked. Pharaoh already had an evil heart, out of which came evil continually. Pharaoh delighted in doing evil. If Pharaoh ever did anything good at all, it was as a result of the constraining and restraining work of Gods common grace.
One of the ways God punishes evil is to allow men to do what they really want, which is to become even more evil. As Paul puts it in Romans 1:24, 26, and 28, God “gave them over” to the evil they want to do. God does this by withdrawing His restraint, which has the result of allowing men hearts to harden against Him. Thus, God does not cause men to sin, nor does He make them bad. Rather, He simply lets them harden themselves, as a punishment for their wickedness.