Updated: May 5, 2019
I believe the reason is to show that even out of our free-will to reject God and go our own way, the Lord's wisdom is so high and His ways are so great, that He is able to use even the most hardened men for His glory and to work out a greater good.
In Moses’ case, he was able to see God strip Pharaoh from his authority and ultimately kill the Egyptians who were trying to kill the children of Israel at the Red Sea: “Then the Lord said to Moses, “Stretch out your hand over the sea, that the waters may come back upon the Egyptians, on their chariots, and on their horsemen.” And Moses stretched out his hand over the sea; and when the morning appeared, the sea returned to its full depth, while the Egyptians were fleeing into it. So the Lord overthrew the Egyptians in the midst of the sea” (Exodus 14:26-27 NKJV). Despite Pharaoh being ruthless towards the Israelites, God ultimately freed the Israelites from the clutches of the Egyptians, brought them to the promised land and brought destruction upon Pharaoh.
God hardening Pharaoh’s heart is also a representation of God's wisdom and His foreknowledge of already having been to the future. Despite God showing mercy to Pharaoh after each plague, God knew Pharaoh was going to go his own way. In Exodus 8-11, Pharaoh promised Moses that he would let the Israelites go if Moses would pray to God and ask Him to stop each plague that was happening in Egypt. Every time Moses prayed and the plagues stopped, Pharaoh would harden his heart and not allow the Israelites to leave. This helped reveal God's omniscience (all-knowing).
God looks backward the same way we look forward. God helped reveal to us in this story that He already knew how things were going to happen. This gives us peace knowing that God has everything under control because He has already been and seen what happens in the future; we have nothing to fret. He sees what will arise in the future (good or evil), but He is still in control and can work all things out for a greater good.
Lastly, it shows us what can happen if we continue shutting God out of our conscious. If we deliberately continue to spit in God's face (not stumbling, but purposely sin and mock His mercy), God will give us over to a reprobate mind (Romans 1:28). It is very dangerous to reject God, because eventually He will say "Fine, have it your way. Don't listen to Me. Don't acknowledge My mercy. I have been merciful time and time again, yet you refuse to listen. I will give you over to your desires and your ways." God has full authority to do so; which is frightening for the person who wants nothing to do with God.
Again, God is always merciful and desires that none should perish (2 Peter 3:9), but there is a point when someone says, “Enough. God be gone from me. I'm going to live the way I want to live and do what I want to do", and God departs. I believe this is what has happened to dictators in history (for example: Hitler and Stalin); but God is able to use even the most vile circumstances and men, and work it out for the greater good. I don’t at all claim to know why God allowed these men to do such barbaric and heinous acts; but I do know that we are now able to use these men as reference points today and say to the Atheist "You see? There is such a thing as evil. It's not just a matter of opinion”. Hopefully this opens up the Atheist’s mind to see that God is the Moral Law Giver who developed the moral law. He is the God that has revealed that there are such things as good and evil that are not based on mere opinions, but are sound facts.
In summary, God hardened Pharaoh’s heart to show that:
God works everything out for good; even with the most evil and wicked men.
God shows He already knows what will happen and is in full control (omniscience).
God shows what can happen to the man or woman that time and time again deliberately disobeys God, rejects His mercy, and chooses their ways over Him. God's mercy is very much enduring, but there comes a point when someone purposely chooses to cut themselves off from God and God gives them over to a reprobate mind.