“For this cause have I made thee to stand [endure], to show thee My power, and that My name may be declared throughout all the earth.” – Exodus 9:16, JPS 1917 Tanach
“G-d’s name would be declared from generation to generation because of the signs which He performed.” – Ibn Ezra, sefaria.org
H’Shem continually hardened Pharaoh’s heart, so that he would remain recalcitrant against G-d’s divine plan to free B’nei Yisrael from bondage, and endure the subsequent plagues; thus, this may be understood as enabling Pharaoh to continue in his resistance, without letting up on his initial rebelliousness. He would not accept the higher authority of H’Shem. Even the Egyptian were approached in mind to gain results that would best suit his own ambitions. There was no sense of capitulating to a moral code that was given upon the authority of these deities.
Yet, with H’Shem, there is both justice and mercy, above and beyond the understanding of mankind, in regard to his commandments; therefore, He responded with justice upon Egypt carried out in the form of ten plagues; and, mercy towards the Children of Israel, who cried out to him in their suffering. Elsewhere it is written, “I will be gracious (חנן) to whom I will be gracious, and I will show mercy (רחם) on whom I will show mercy” (Exodus 33:19).
Because of Pharaoh’s unrepentant heart, H’Shem could not show mercy towards him; by hardening Pharaoh’s heart, he strengthened only his position. Rashi explains that the first five times, Torah mentions that “Pharaoh’s heart was hardened,” implying an act of self-volition. Only, for the sake of G-d’s own glory, demonstrated through the plagues decreed upon Egypt, did H’Shem permit Pharaoh to remain recalcitrant.
Pharaoh’s recalcitrance is demonstrative of this principle: “at scoffers He scoffs, but to the lowly He shows grace” (Proverbs 3:34, JPSN). Pharaoh scoffed at the idea of H’Shem, whom he never heard of, commanding him to free His people. Pharaoh hardened his own heart five times. Only then does H’Shem harden the heart of Pharaoh in accordance with Pharaoh’s arrogance. Thus, Pharaoh’s fate was sealed by his own pride.
Even so, “I will be gracious to whom I will be gracious, and will show mercy on whom I will show mercy” (Exodus 37:19, JPS). If a person’s heart is hardened toward G-d through sin, then he is unlikely to receive G-d’s grace. G-d will let him remain stuck in his recalcitrance. Yet, if we, out of humility, open our hearts to G-d, He will show compassion toward us, and bestow His grace (favor) upon us. The treasures that we will receive are those of Malchus Elokim (the Kingdom of G-d) in the next life, and the blessings of the Shechinah in this life.