Someone asked this question on suffering at Christianity Stack Exchange, a site where I answer questions now and then. One of the answers to this question (given by a resident of Cape Town, South Africa) was so comprehensive regarding suffering that I thought it worth sharing his or her nine points here. This is my edited version of the answer given; you could read the original on this page.
Why is there suffering in the world?
1. The first and best answer to suffering is the free will defense, in which people are able to make choices for good or evil. God made us as free people, not robots — people who cannot do certain things are not truly free. So we endure affliction at the hands of people who use their liberty to hurt us deliberately or indirectly.
2. The ability to suffer physical pain fulfills a valuable function: it signals that our body is about to be damaged. Without it we may be incurably harmed. Many medical diseases are accompanied by pains of all kinds, and they rouse us to seek a cure before it is too late. Emotional and psychological pain can also drive us to seek help.
3. The Bible tells us that God uses our suffering in this world to improve our character and conform us into the image of Christ. Human interactions can open the door to different kinds of sufferings that can cause us to voluntarily strengthen our resolve. For instance, we suffer when we struggle against sinful promptings, and so bolster our inner restraint. We suffer when we submit to humiliation rather than hit back. Jesus suffered like we did (but without ever sinning), and through it was perfected to become high priest for us (Hebrews 2:10). In these ways and others good character is formed and fits us for some future task or position. Also, Jesus suffered, showing us that suffering is not an infallible indication that God is against us. Where Satan meant to do us harm, God turns to his advantage to train us up for his kingdom.
4. The ability to suffer forms the basis of a universal, intuitive moral code. Everyone, no matter what they believe about God, recognizes that causing pain and suffering to innocents is wrong. Without this code, people would be more evil; they would not consider the consequences of their actions, and thus trivialize right and wrong. (We loosen our moral restraints in the company of others we admire who devalue human life.) Hence, suffering is an essential ingredient in a world where right and wrong matter.
5. Suffering makes our choices serious, affirming the preciousness of our lives. This is true whether people do good or evil. Knowing that we or others will suffer because of a choice we are pondering often causes us to seek alternatives that are less drastic.
6. Suffering provides warning that the end is near; it reminds us of our mortality. Natural suffering (such as earthquakes and tsunamis) remind people that death can come at any time, and salvation is essential. It is most often those who do not experience suffering that see suffering as an obstacle to belief in God (“I can’t believe in God if there is suffering in the world – surely God would put a stop to it”). It has been said that people in poverty are more often believers than the affluent; people go to Heaven homeless and to Hell in comfort. As another saying goes, there are no atheists in foxholes.
7. With regards to death, it is within God’s prerogative to end life. If life is some sort of test, then a time limit was always part of God’s plan. When people kill, it violates this plan, perhaps interfering with the test. (Often, we have no way of knowing when a death has been “untimely” or not in God’s perspective.) Also, God alone chooses when people have had enough time for their work.
8. Suffering is a sign that all is not right with the world, confirming the biblical doctrine of the Fall and sin. It provides a foundation for the gospel, in which God will restore all things and create a new heavens and a new earth in which righteousness will reign. We instinctively want justice, and it comforts us to know that all will be taken care of in due time.
9. Finite suffering (no matter how seriously) is ultimately inconsequential compared to eternity. As Paul the apostle wrote, “For I consider that the sufferings of this present time are not worthy to be compared with the glory which shall be revealed in us” (Romans 8:18).
10. Suffering is part are parcel of God’s chastisement of His child (Hebrews 12:7-11). It is evidence that God sees us as His child, and He is bringing hardship into our life to bring us back to Himself. If we have no hardships after sinning against Him, then we are not His child. A good father would correct his children to keep them in the right way, and the heavenly Father does no less.
In summation, suffering fits within a world that believes in right and wrong, where choices matter and where God is interested in more than just our temporary happiness. Any answer to the contrary relies on the (quite childish) assumption that God only intends our comfort.