וַיִּשְׁלַ֣ח פַּרְעֹ֗ה וַיִּקְרָא֙ לְמֹשֶׁ֣ה וּֽלְאַהֲרֹ֔ן וַיֹּ֥אמֶר אֲלֵהֶ֖ם חָטָ֣אתִי הַפָּ֑עַם יְהוָה֙ הַצַּדִּ֔יק וַאֲנִ֥י וְעַמִּ֖י הָרְשָׁעִֽים׃
И послал фараон и призвал Моисея и Аарона и сказал им: 'Я согрешил на этот раз; Господь праведен, а я и народ мой беззаконны.
Chizkuni
ה' הצדיק, it is Hashem who is righteous. During all of the plagues, the only one which resulted in Pharaoh acknowledging that G-d was righteous, hail was the only one. What prompted Pharaoh to make such a confession? When someone is at war with someone else and wants to liquidate him, he arranges to do this when his adversary does not suspect it, and he jumps him suddenly. Here, G-d, instead of bringing on the plague without warning, gives His creatures a chance to escape with their lives. He Himself urged them to take shelter.
Da'at Zekenim
ה' הצדיק, “the Lord is the righteous One;” the reason why Pharaoh acknowledged this in connection with the plague of hail more than with any other plague, was that G–d had issued a warning to the people that G–d had issued a warning to the people to take refuge from the lethal effects of the hail if they did not move indoors. (verse 19) When he added: “I and my people are wicked,” this was an admission that by not bringing their livestock indoors they themselves had caused them to die. (Shmot Rabbah 12,5)
Ramban
I HAVE SINNED THIS TIME. The explanation thereof is: “This time I will acknowledge the Eternal,221See Ramban above, 8:15, that throughout, Pharaoh did not acknowledge the Eternal, the G-d of Israel. Ramban points out that this was the first time Pharaoh did acknowledge Him. Ramban transposes the words, chatathi hapa’am Hashem hatzadik, and explains them as follows: “This time I acknowledge the Eternal, for I have sinned against Him, etc.” for I have sinned against Him, and He is the righteous One, and I and my people are wicked, for we have rebelled against His word from then until now.”