Why did God harden Pharaoh's heart?
(ג) וַאֲנִ֥י אַקְשֶׁ֖ה אֶת־לֵ֣ב פַּרְעֹ֑ה וְהִרְבֵּיתִ֧י אֶת־אֹתֹתַ֛י וְאֶת־מוֹפְתַ֖י בְּאֶ֥רֶץ מִצְרָֽיִם׃ (ד) וְלֹֽא־יִשְׁמַ֤ע אֲלֵכֶם֙ פַּרְעֹ֔ה וְנָתַתִּ֥י אֶת־יָדִ֖י בְּמִצְרָ֑יִם וְהוֹצֵאתִ֨י אֶת־צִבְאֹתַ֜י אֶת־עַמִּ֤י בְנֵֽי־יִשְׂרָאֵל֙ מֵאֶ֣רֶץ מִצְרַ֔יִם בִּשְׁפָטִ֖ים גְּדֹלִֽים׃ (ה) וְיָדְע֤וּ מִצְרַ֙יִם֙ כִּֽי־אֲנִ֣י יְהוָ֔ה בִּנְטֹתִ֥י אֶת־יָדִ֖י עַל־מִצְרָ֑יִם וְהוֹצֵאתִ֥י אֶת־בְּנֵֽי־יִשְׂרָאֵ֖ל מִתּוֹכָֽם׃
(3) But I will harden Pharaoh’s heart, that I may multiply My signs and marvels in the land of Egypt. (4) When Pharaoh does not heed you, I will lay My hand upon Egypt and deliver My ranks, My people the Israelites, from the land of Egypt with extraordinary chastisements. (5) And the Egyptians shall know that I am the LORD, when I stretch out My hand over Egypt and bring out the Israelites from their midst.”

(כא) ואני אחזק את לבו כי בהיותו בלתי יכול לסבול המכות היה משלח את העם בלי ספק, לא מפני שיכנע לאל יתברך לעשות רצונו, ולזה חזק את לבו שיתאמץ לסבול המכות ולבלתי שלחם:

(21) ואני אחזק את לבו, for if he could not endure the plagues he would let the Israelites go, not because he was finally humbling himself before the Lord and do His will, but only in order to get relief from the plagues. This was not a good enough reason to grant him relief; therefore G’d reinforced his natural obstinacy.

Rambam (Maimonides), Mishneh Torah, Laws of Repentance 6:3

They sinned intentionally and eagerly transgressed until they deserved to be denied teshuvah, which is the “remedy.” Therefore it is written in the Torah: I will harden Pharaoh’s heart (Ex. 14:4) – since he initially sinned of his own initiative and abused Israel, who were living in his land, as it says, Come, let us deal cleverly with them (Ex. 1:10), judgment was rendered to deny [Pharaoh] teshuvah until [God] punished him – therefore the Holy Blessed One hardened [Pharaoh’s] heart.

(ג) דבר אחר: כי אני הכבדתי את לבו - אמר רבי יוחנן: מכאן פתחון פה למינין לומר, לא היתה ממנו, שיעשה תשובה, שנאמר: כי אני הכבדתי את לבו. אמר לו רבי שמעון בן לקיש: יסתם פיהם של מינים, אלא (משלי ג, לד): אם ללצים הוא יליץ, שהקדוש ברוך הוא מתרה בו באדם, פעם ראשונה, שניה ושלישית, ואינו חוזר בו, והוא נועל לבו מן התשובה, כדי לפרוע ממנו מה שחטא. אף כך פרעה הרשע, כיון ששיגר הקדוש ברוך הוא חמש פעמים ולא השגיח על דבריו. אמר לו הקדוש ברוך הוא: אתה הקשית ערפך והכבדת את לבך, הריני מוסיף לך טומאה על טומאתך. הוי, כי אני הכבדתי את לבו. מהו הכבדתי? שעשה הקדוש ברוך הוא את לבו ככבד הזה, שהיא מתבשלת שניה וארטסים נכנס בתוכה. כך נעשה לבו של פרעה ככבד הזה ולא היה מקבל דבריו של הקדוש ברוך הוא. הוי, כי אני הכבדתי את לבו וגו':

(3) Another explanation: For I have hardened his heart - Rabbi Yochanan said: Does this not provide heretics with an opportunity to open their mouths to say that he had no means of repenting, as it say "For I have hardened his heart". Rabbi Shimon ben Lakish said to him: Let the mouths of the heretics be stopped up. Rather, (Mishlei 3:34) If it concerns the scorners, he scorns them. When the Holy One Blessed be He warns a man once, twice, thrice and he doesn't repent, and G-d will close his heart against repentance so that He should not exact vengeance from him for his sins. So to with the wicked Pharaoh, since Hashem sent five times to him and he took no notice, G-d then said: "You have stiffened your neck and hardened your heart; well, I will add impurity to your impurity". Hence, "For I have hardened his heart". What does "I have hardened" imply? That G-d made his heart like a liver (כבד) into which even if boiled a second time no juice enters; so also was the heart of Pharaoh made like a liver, and he did not receive the words of G-d. Hence, "For I have hardened his heart".

(ג) ואני אקשה את לב פרעה אמרו במדרש רבה (שמו''ר ה ו) גילה לו שהוא עתיד לחזק את לבו בעבור לעשות בו הדין, תחת שהעבידם בעבודה קשה. ועוד שם (יג ד) כי אני הכבדתי את לבו (להלן י א), אמר רבי יוחנן מכאן פתחון פה למינין לומר לא היתה ממנו שיעשה תשובה. אמר רבי שמעון בן לקיש יסתם פיהם של מינין, אלא אם ללצים הוא יליץ (משלי ג לד), מתרה בו פעם ראשונה ושניה ושלישית ואינו חוזר בו והוא נועל בו דלת מן התשובה כדי לפרוע ממנו מה שחטא. כך פרעה הרשע, כיון ששגר הקב''ה אצלו חמש פעמים ולא השגיח על דבריו, אמר לו הקב''ה אתה הקשית את ערפך והכבדת את לבך, הריני מוסיף לך טומאה על טומאתך:
והנה פירשו בשאלה אשר ישאלו הכל, אם השם הקשה את לבו מה פשעו, ויש בו שני טעמים ושניהם אמת האחד, כי פרעה ברשעו אשר עשה לישראל רעות גדולות חנם, נתחייב למנוע ממנו דרכי תשובה, כאשר באו בזה פסוקים רבים בתורה ובכתובים, ולפי מעשיו הראשונים נדון. והטעם השני, כי היו חצי המכות עליו בפשעו, כי לא נאמר בהן רק ויחזק לב פרעה (להלן פסוק יג, כב, ח טו), ויכבד פרעה את לבו (להלן ח כח, ט ז). הנה לא רצה לשלחם לכבוד השם, אבל כאשר גברו המכות עליו ונלאה לסבול אותם, רך לבו והיה נמלך לשלחם מכובד המכות, לא לעשות רצון בוראו. ואז הקשה השם את רוחו ואמץ את לבבו למען ספר שמו, כענין שכתוב והתגדלתי והתקדשתי ונודעתי לעיני גוים רבים וגו' (יחזקאל לח כג):
ואשר אמר קודם המכות (לעיל ד כא) ואני אחזק את לבו ולא ישלח את העם, יודיע למשה העתיד לעשות בו במכות האחרונות, כענין שאמר (לעיל ג יט) ואני ידעתי כי לא יתן אתכם מלך מצרים להלוך וזה טעם ואני אקשה את לב פרעה והרבתי את אותותי, כלומר שאקשה לבו למען רבות מופתי בארץ מצרים. כי בחמש מכות האחרונות גם בטביעת הים נאמר ויחזק ה' (להלן יד ח), כי לב מלך ביד ה' על כל אשר יחפוץ יטנו (משלי כא א):

(3) And I will harden Pharaoh’s heart – they said in the Midrash Rabbah (5:6) that [God] revealed to him that [God] would in the future harden [Pharaoh’s] heart so that judgment would be done on him for enslaving them with hard labor. And we read more there (13:4) because I made his heart heavy (Shemot 10:1) – from this verse, said Rabbi Yochanan, the minim say that he had no chance of doing teshuvah. Rabbi Shimon ben Lakish answered: ‘let the mouths of the minim be closed, rather He laughs at mockers (Mishlei 3:34), he was warned once, and twice and three times and he did not repent, and He closes the door of teshuvah so to extract [retribution] from him what he sinned. So with the evil Pharaoh, God sent [warnings] to him five times and he did not listen to [God’s] words, God said to him: ‘you stiffened your neck and you made your own heart heavy, behold I am going to add impurity to your impurity. (3) And here is the answer to the question that everyone asks: If God hardened Pharaoh’s heart, what then was his transgression [since he had no choice]? There are two answers, which both hold true: First, Pharaoh, in his wickedness, had unjustifiably treated the Jews terribly, so he was punished with the withdrawal of the path of repentance, and there are many verses regarding this in the Torah and the Writings, and he was punished by his original deeds. Secondly, only the second half of the [ten] plagues were brought upon Egypt due to Pharaoh’s transgressions, as the Torah states, And Pharaoh’s heart was strengthened, (Shemot 7:13, 26; 8:15), and Pharaoh hardened his heart (ibid. 8:28, 9:7). He did not want to send the Jews out of Egypt for the glory of God; rather, when the plagues increased and he was becoming too worn out to withstand them, his heart softened and he decided to send them out because of the severity of the plagues themselves, but not in order to do the will of his Creator. Therefore, God strengthened his spirit and gave courage to his heart so that His Name would be declared [throughout the world], as we read: Thus will I magnify Myself, and sanctify Myself, and I will make Myself known in the eyes of many nations; and they shall know that I am Adønαi. (Ez. 38:23) (4) And that that is written before the plagues (Shemot / Ex. 3:19) and I know that the king of Egypt will not let you go, this is the reason for and I will stiffen Pharaoh’s heart and multiply My wonders that is to say that I will stiffen his heart so as to increase my wonders in the land of Egypt, because in the last five plagues, and also in the drowning at the sea it is written and Adønαi strenghthened (14:8) because the heart of the king is in the hand of Adønαi He turns it how He wants.

The Lord hardened his heart, so that he imagined that the plague was accidental rather than providential (from God)...only then could it be demonstrated whether his repentance was freely motivated.

-Albo, Sefer Ha-ikkarim (Book of Principles)

Moshe Greenberg on Ex. 7:3 I will harden Pharaoh's heart

The verse raises major moral and theological problems. If Pharaoh is foreordained to reject Moses' plea, if God will arrange for the confrontation to continue, how can Pharaoh be held responsible for his actions and how can we justify his being punished for what God causes him to do? "Although 'hardening of the heart' seems deterministic, events flow naturally from the ambitions and conflicts of a human being, Pharaoh, who is seized with the delusion of self-sufficiency. While events unfold under the providence of God, their unfolding is always according to the motives of the human beings through whom God's will is done without realizing it... Pharaoh conducted himself in conformity with his own motives and his own Godless view of his status. God made it so, but Pharaoh had only to be himself to do God's will."

וא"ר יוחנן מפני מה לא נאמר כי טוב בהודאה זו לפי שאין הקב"ה שמח במפלתן של רשעים ואמר רבי יוחנן מאי דכתיב (שמות יד, כ) ולא קרב זה אל זה כל הלילה בקשו מלאכי השרת לומר שירה אמר הקב"ה מעשה ידי טובעין בים ואתם אומרים שירה

This is because the Holy One, Blessed Be He, does not rejoice at the downfall of the wicked. And Rabbi Yohanan said: Why has it been written (Exodus 14:20): "This one did not draw near to that one the whole night."? The ministering angels sought to recite a song, [but] the Holy One, Blessed Be He said: The work of My hands is drowning in the sea, and you are reciting a song???