What does Romans 9:18 mean?
Paul is making the argument that God retains the right, as an absolutely sovereign Creator, to give His mercy to one person and not to another, accordingly only to His own purposes. Paul has shown that God's choice to give or withhold mercy is not based on either person's behavior. He is not obligated to be merciful to anyone, or obliged to bless some more than others. 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 7:13; 8:15). 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.
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.