"Behold, at this time tomorrow I will rain down [very heavy hail]," and so forth. Rather, "And now send and bring your livestock under shelter," and so forth (Exodus, there, 9:19). Our masters said: In all the plagues Pharaoh did not say "The Lord is righteous," except in the plague of hail alone. Why? A person who seeks to fight with his fellow and to defeat him comes upon him suddenly, and kills him, and takes everything that he has. But the Holy One, blessed be He, said to Pharaoh, "And now send and bring your livestock under shelter," and so forth. At that moment he said, "The Lord is righteous" (there, there, 9:27).
Why Pharaoh Called the Lord Righteous Only at the Hail
Midrash Tanchuma Buber, Vaera 20:2
הנני ממטיר כעת מחר וגו', אלא ועתה שלח העז את מקנך וגו' (שמות שם יט). אמרו רבותינו בכל המכות לא אמר פרעה ה' הצדיק אלא במכת ברד בלבד, למה אדם שהוא מבקש להלחם עם חבירו ולנצח אותו, פתאום הוא בא עליו, והורגו ונטל כל מה שיש לו, אבל הקב"ה אמר לפרעה, ועתה שלח העז את מקנך וגו' באותה שעה אמר ה' הצדיק (שם שם כז).