This is a question I get often from around the world. The first question to wrestle with is, "Is God truly good?" I cannot answer that question for anyone else other than me, and I have concluded that, yes, he is good. I was holding my first wife when her heart stopped (due to a terminal illness) and, in the midst of the torrent of tears, I remember the shocking realization that my faith was real and that I still loved God. I did not UNDERSTAND why this happened, but my love and faith were authenticated in that moment. In the following years, I have seen affliction and suffering come from one of three primary sources. First, there is an evil perpetrator causing harm beyond description to another. Second, natural consequences can lead to suffering. If you get drunk and drive, there are likely unpleasant consequences. Third, like Job, God decides that suffering is necessary to accomplish his greater purpose that all come to know him and worship him alone as God.
Having said this, it is important to remember that God's ideal world is a pain-free world devoid of suffering and affliction. But he gave us the choice to obey and we chose to disobey... leading to a fallen world. God has since chosen to operate within that fallen world, compassionately pursuing people that they might come to the wonderful, saving knowledge of him... and that includes suffering. This leads to the question of how suffering could possibly be good?
In my many years of ministry I have seen three possible reasons why God would both allow and use suffering for his purposes. First, to validate our faith. How would you know your faith is real if it is never tested? (James 1:2-4). Second, it strengthens the unity of the church in that we who have suffered, have the opportunity to comfort others who are suffering (2 Corinthians 1:3-7). As a pastor, I have had many opportunities to observe the Spirit move throughout our congregation to allow us to share this gift. In a fallen world, what would our communities be like if we never had to cry? Freedom from tears will come later. Third, suffering is the one language that the world understands. We do not have to explain it to them. What they do not understand is God's grace and how we patiently endure and grow through it. This seems to be where Paul is heading in his Epistle to the Philippians (Phil 1:27-30). This means that our suffering is used by God to attract others who are suffering and desire to be freed from the pain!
I understand this is a woefully simple answer to a very complex question. If you are one who is suffering deeply, please hang in there and continue to trust God, and let him have his way in this evil and perverse world. The verse that carried me through the tears and anger all those years ago was Psalm 34:18, "The LORD is close to the brokenhearted and saves those who are crushed in spirit." Please don't give up hope!