For the Scripture says to Pharaoh, “For this very purpose I have raised you up, that I might show my power in you, and that my name might be proclaimed in all the earth.”
Romans 9:17 ESV
Pharaoh was temporarily elevated, not because he deserved it, but because God’s judgment against him would be even more apparent because of the height from which he fell. God requires protagonists and antagonists to carry the plot of salvation to the end. One he chooses to lead his people, another he chooses to correct them, and yet another he chooses as an object lesson to the world.
This doesn't say anything about Pharaoh's eternal destiny. His election was to a role in the liberation of the Hebrews. While it seems unlikely that he had a last minute repentance as the sea closed in on him, we can't really know.