However this question is answered, we must guard against oversimplification. Suffering is remarkably complicated, and so are the reasons that God allows it.
To demonstrate the complexity of this issue I refer once again to Walter Kaiser's book, Grief And Pain In The Plan Of God. In this book Kaiser gives eight reasons why God allows or brings suffering. They are Retributive, Disciplinary, Empathetic, Vicarious, Doxological, Revelation, Apocalyptic, and Testimonial
To begin with, there are times when God brings suffering for purposes of retribution. By this we mean, the suffering is a result of sin. The longsuffering of God runs out and He pours out his wrath upon people because of their iniquity.
Examples of retributive suffering are found throughout the Word of God. In Numbers 16 Korah usurps the authority of God's appointed leader, Moses, and as a result God causes an earthquake that consumes him and his family. Acts 12 records the incident of Herod, who stretches out his hand to vex the church of God. His persecution is short lived, as an angel of the Lord strikes him dead. One of the most vivid scenes of retributive suffering is witnessed in the book of Revelation. The Lamb is seen pouring out his "wrath" upon a world that has rejected the rule of God. The suffering that occurs in Hell would also fit into this category. As unpleasant as it is to think about, Hell is a place where God punishes people for their sin.
What is abundantly clear in passages such as these is that the primary reason for the pain and suffering is punishment. God is not just teaching people a lesson or chastening them so that they might grow spiritually, He is causing the suffering because His righteousness has been transgressed and it is within His nature to punish sin. Retributive or punitive suffering comes as a direct result of sin.
Most people recoil at the idea of an angry God. Their first reaction is to reject such an unpleasant doctrine in favor of the love of God. However, before dismissing the idea we need to remember the collateral damage that we will cause by not emphasizing God's wrath against sin. By rejecting God's anger against sin we do irreparable damage to the love of God that we wish to protect. Remember, the greatest expression of the love of God occurred when Jesus Christ went to the cross to die for our sins (Jo. 3:16). At the cross, Jesus absorbed the wrath of God that sinners deserve (1 Jo. 2:2). His cry of pain on the cross was in place of my cry in Hell. He was wounded for my transgressions (Isa. 53:5). Put simply, if we remove the notion that God gets angry at sin then we are not only left with a God who merely loves us in a sentimental way, but we have also made the cross of Christ of none effect (1 Cor. 1:17).