Thank you for the question on God “changing his mind” on King Hezekiah, “If God cannot change his mind, what happened in the case of King Hezekiah?”
II Kings says this, “In those days Hezekiah was stricken with a terminal illness. The prophet Isaiah son of Amoz visited him and told him, “This is what the LORD has said, ‘Give your household instructions, for you are about to die; you will not get well.’” 2 He turned his face to the wall and prayed to the LORD, 3 “Please, LORD. Remember how I have served you faithfully and with wholehearted devotion, and how I have carried out your will.” Then Hezekiah wept bitterly.
4 Isaiah had not yet left the middle courtyard when the LORD’s message came to him, 5 “Go back and tell Hezekiah, the leader of my people: ‘This is what the LORD God of your ancestor David has said: “I have heard your prayer; I have seen your tears. Look, I will heal you. The day after tomorrow you will go up to the LORD’s temple. 6 I will add fifteen years to your life and rescue you and this city from the king of Assyria. I will shield this city for the sake of my reputation and because of my promise to David my servant.”’” 7 Isaiah ordered, “Get a fig cake.” So they did as he ordered and placed it on the ulcerated sore, and he recovered” (NIV).
II Kings 20 states that King Hezekiah knew he was seriously ill with a poor outcome for him. He had the best medical treatment for his illness. Nothing was effective. His condition worsen until he was at “death’s doorstep.”
God sent Isaiah to declare to Hezekiah what he already knew. He was about to die. This was the revealed and known will of God to Hezekiah unless God was to intervene in some supernatural means. It is a conjecture on my part that Hezekiah didn’t prayed to God or sought the favor of God. He may have thought his royal physicians could or would healed him. When his physicians could do nothing to cure him, his health continued to deteriorate. There is no indication that Hezekiah sent for Isaiah to inquire of the Lord. Since he didn’t asked for God’s prophet to come to him, God sent his messenger to Hezekiah that death was impending.
When Hezekiah heard that message from Isaiah, he knew that there was nothing humanly can be done to prevent his death. He wept bitterly and asked God to intervene and spare his life. The test was on Hezekiah on how he would respond to his dire circumstances. Would his pride keep him from turning to God or will he turn to God? It was his choice. If Hezekiah did nothing at all, he would have died. God would have allow the natural course of illness to end his life. Because of his prayer to God, God intervened and extended his life.
Did God knew that Hezekiah was going to pray? Yes, since God is omniscience, he declared that Hezekiah had 15 more years. It was not a surprise to God, but it was as surprise to Hezekiah that God was gracious and extending his life.
SUMMARY: God didn’t change his mind, but Hezekiah changed his mind about God.
For more perspectives:
https://www.quora.com/If-God-cannot-change-his-mind-what-happened-in-the-case-of-King-Hezekiah