Romans 9:18.............
"Therefore hath he mercy on whom he will have mercy, and whom he will he hardeneth."
The point is.........Nobody "deserves" mercy, so there is nothing unjust or inappropriate about God's choice.
That applies as much to moments when God pointedly withholds mercy as it does to those times when He grants it.
In fact, in the previous verse, Paul cited the example of God's words to Pharaoh before delivering one of the plagues on Egypt. Through Moses, God told Pharaoh that God had raised him up to show His own power over Egypt and to make His own name proclaimed in the earth. In other words, God raised Pharaoh up in order to rain down plagues upon Egypt for the sake of His own glory.
Paul states again that God will have mercy on anyone He wants to. Now, though, Paul adds a new statement: God will harden whomever He wishes to, as well.
This, too, is a reference to Pharaoh. This ruler had made a clear choice to reject God's will. Exodus 10:1 quotes God telling Moses that He had hardened Pharaoh's heart to keep Pharaoh from letting the Israelites go. This was so God could continue showing Himself through the signs of the plagues. God does the same thing to Pharaoh's heart at least four more times after this.
Pharaoh, then, is the one God held responsible for saying no to Moses' request from God to let the Israelites go. In particular, his refusal of the initial request set up the rest of Egypt's troubles. After that, God clearly intervened to make Pharaoh continue in his hard-heartedness towards Israel.
Dr. J Vernon Magee in his Commentary explains that God did not “harden Pharaoh’s heart” so much as “allow Pharaoh’s heart to be hardened”. This was achieved allowing Pharaoh to (incorrectly) perceive limits to God’s power in bringing the plagues.
Paul is insisting that God has every right to do this because He is God. He owes no one anything. The fact that He gives mercy to some of us—any of us—is a gift, not an obligation (Romans 4:2–5; 11:6). He is God.
Nobody "deserves" mercy, so there is nothing unjust or inappropriate about God's choice. That applies as much to moments when God pointedly withholds mercy as it does to those times when He grants it.
Here is the first encounter with Pharaoh:
Exodus 5:
1 Afterward Moses and Aaron went in and told Pharaoh, "Thus says the Lord God of Israel: 'Let My people go, that they may hold a feast to Me in the wilderness.' "
2 And Pharaoh said, "Who is the Lord, that I should obey His voice to let Israel go? I do not know the Lord, nor will I let Israel go."
3 So they said, "The God of the Hebrews has met with us. Please, let us go three days' journey into the desert and sacrifice to the Lord our God, lest He fall upon us with pestilence or with the sword."
4 Then the king of Egypt said to them, "Moses and Aaron, why do you take the people from their work? Get back to your labor."
5 And Pharaoh said, "Look, the people of the land are many now, and you make them rest from their labor!"
6 So the same day Pharaoh commanded the taskmasters of the people and their officers, saying,
7 "You shall no longer give the people straw to make brick as before. Let them go and gather straw for themselves.
8 And you shall lay on them the quota of bricks which they made before. You shall not reduce it. For they are idle; therefore they cry out, saying, 'Let us go and sacrifice to our God.'
9 Let more work be laid on the men, that they may labor in it,
and let them not regard false words."
The words in bold gives us the first time I know of that a government assumes it has the authority to decide what is truth and what is "fake news". Pharaoh shows his heart here in this passage, and God knew his heart as well, knowing all the attributes that are against God and His nature. When we see the Bible listing these attributes as abominations towards God, whether in Proverbs, in Paul's writings or scattered throughout the Bible, Pharaoh seems to have more than his share. So, we see God is not unfair with Pharaoh as He is putting pressure on Pharaoh and hardens his already hardened heart in the rest of the account involving Pharaoh. So God can righteously say, "I know who you are and have raised you up to show My power in you and My name shall be declared to all the earth because of your actions."
God already knew Pharaoh's heart and Esau's heart, since he made them. They had plenty of chances to cry out to God and realize their depravity. God uses these depraved souls to further His plans for humanity. His plans have so many layers and complexities that it is ridiculous for us to question God or accuse Him of unfairness. Esau showed his priorities when he sold his birthright for some food. Some people just won't accept God's gift of mercy.