At first, when I read this passage, I thought that King Hezekiah was saying "My peace was taken away, and I was given great bitterness instead."
That's not how to read the passage, however.
The New International Version expounds what Hezekiah prayed more accurately:
"Surely it was for my benefit that I suffered such anguish. In your love you kept me from the pit of destruction; you have put all my sins behind your back."
Hezekiah's pain resulted from a terrible illness, one in which the prophet Isaiah told him would result in his death:
"1In those days was Hezekiah sick unto death. And Isaiah the prophet the son of Amoz came unto him, and said unto him, Thus saith the LORD, Set thine house in order: for thou shalt die, and not live." (Isaiah 38:1)
Hezekiah was a man of great faith, and he was not afraid to ask God for mercy:
"2Then Hezekiah turned his face toward the wall, and prayed unto the LORD, 3And said, Remember now, O LORD, I beseech thee, how I have walked before thee in truth and with a perfect heart, and have done that which is good in thy sight. And Hezekiah wept sore." (Isaiah 38:2-3)
Bear in mind that we walk before God in a perfect heart when we believe on HIM!
Just like blessed, believing Abraham! (Genesis 15:6; Galatians 3:9)
God not only restored Hezekiah to health, He promised the great king fifteen more years of life, and He removed the fierce Assyrians from attacking Judah!
What a victory! What a reversal of grace for this king.
Then followed Hezekiah's wonderful Song of Thanksgiving, and one key verse stands out:
"Behold, for peace I had great bitterness: but thou hast in love to my soul delivered it from the pit of corruption: for thou hast cast all my sins behind thy back." (Isaiah 38:17)
"Great bitterness" in the original Hebrew is "mara mara" -- superlative bitterness, the worst, hardest time imaginable.
Indeed, Hezekiah went through untold troubles: healthwise, emotionally, and even politically, since the kingdom of Judah was under seige from the King of Assyria! And all at the same time!
Yet Hezekiah would then say "Surely it was for my benefit". In fact, that word "peace" is "Shalom", which speaks to consummate wholeness in every manner: physically, mentally, spiritually, emotionally, politically (for the king's sake), etc.
And the manner in which God saved Hezekiah--and saves us!
"In love to my soul" - this is "Chazaq" love, which communicates that God is so attached, so longing for us!
No matter how bad it gets, no matter how great the trials, just turn your face toward your loving Father. He will hear you, and He will cause the worst of trials to turn to your benefit!