We are refined by fire because God loves us.
Before I was afflicted I went astray, But now I keep Your word. – Psalm 119:67
It is good for me that I was afflicted, That I may learn Your statutes. – Psalm 119:71
God has taught us the truth and the right way to approach life. If we were to simply listen to His instruction and follow closely after His ways we would find our lives blessed and full of joy. He doesn’t promise an easy life necessarily, but a blessed one.
Obviously most of us are still having trouble with that whole “listening to God” thing and doing what He says. We are hard headed and hard hearted many times. We go our own way. We learn the hard way.
So at some point God says (essentially) “Go ahead, go down that road. You’ll feel pain and regret, but it will teach you a valuable lesson or two.”
In addition, there are times when God will send us trials that are unrelated to our sin (though it is sometimes impossible to know what is or isn’t tied to our sin). Sometimes He’ll simply put us to the test so that we will gain perspective and learn to lean completely on Him.
Either way, God allows us to go through suffering because he knows it will teach us lessons.
Note: I write most of this from the perspective of someone who has had a relatively easy life, all things considered. I’d say that my struggles and trials have been of the “First World Problems” variety. At least compared to the modern day Jobs walking around. I don’t envy them though I do admire them. So if I’ve oversimplified or missed a key point here, please forgive my lack of experience in the subject.