It has been asked, if Allah (God) exists, then why do we suffer? I believe that this is a bold and valid question. Even more, that someone poses this question may well be a sign of God's mercy and the individual's spiritual health.
First of all, we accept that we have been created by Allah (God). Allah says in the Quran:
O mankind, worship your Lord, who created you and those before you, that you may become righteous – [He] who made for you the earth a bed [spread out] and the sky a ceiling and sent down from the sky, rain and brought forth thereby fruits as provision for you. So do not attribute to Allah equals while you know [that there is nothing similar to Him]. Surah Al-Baqarah 2:21-22
The purpose of our creation is clarified immediately: to worship, to be righteous. In the Quran, Allah calls us 'servants.' In order to discover the answer to the purpose of our suffering on earth, it is absolutely essential to understand and accept that Allah (God) is our master/ruler (the most Merciful), and we are Allah's servants/slaves. To be Muslim, by definition, means to be 'submitted.' Here in Surah Al-Baqarah is an indication of the person's role as servant, along with a clear expression of Allah's mercy:
And when My servants ask you, [O Muhammad], concerning Me – indeed I am near. I respond to the invocation of the supplicant when he calls upon Me. So let them respond to Me [by obedience] and believe in Me that they may be [rightly] guided. Al-Baqarah 2:186
Having established this relationship, the Muslim accepts that we are created by the mercy of Allah. As we are the servants of Allah, we are entitled to absolutely nothing. I believe that westerners, in particular, tend to incorporate a great sense of entitlement into our religious practice. In actuality, absolutely everything we have, including good health, functioning limbs, the five senses, are gifts from Allah that we do not deserve. Truly, we've done nothing to earn or deserve what we often assume are entitlements. Similarly, neither are we entitled to wealth, ease, or happiness in this life. That we were created alone is a sign of Allah's mercy. What we have of such things is all a sign of Allah's mercy.
But the Jews and the Christians say, "We are the children of Allah and His beloved." Say, "Then why does He punish you for your sins?" Rather, you are human beings from among those He has created. He forgives whom He wills, and He punishes whom He wills. And to Allah belongs the dominion of the heavens and the earth and whatever is between them, and to Him is the [final] destination. Al-Baqarah 2:18In the scope of eternity, our mortal life is quite short. Keeping this in mind, we recognise that suffering is a test from Allah. Life is a constant test - will we respond with patience? Will we respond to life's challenges by being humble before Allah, and not defiant? Will we respond with gratefulness for what we have? Take the example of this 11 year old girl from New Delhi, who was born with a disability. Her story, featured by Aamir Khan on his show Satyamev Jayate, starts at minute 1:11, is subtitled, and ends at minute 3:35:
He (The Prophet Salih) said, "O my people, why are you impatient for evil before [i.e., instead of] good? Why do you not seek forgiveness of Allah that you may receive mercy?" They said, "We consider you a bad omen, you and those with you." He said, "Your omen [i.e., fate] is with Allah. Rather, you are a people being tested. Surat Al-Kahf 18:46-47
However, suffering is not our only test. Just as some are tested with hardship and poverty, others are tested with ease and wealth. In fact, it is those who are granted a life of ease who have the greater test, as they are much more prone to attribute their success to their own doing. In other words, to be handed a life of ease, and to not acknowledge the true Source of everything that one has is dangerous, punishable behavior.
And if Allah should touch you with adversity, there is no remover of it except Allah; and if He intends for you good, then there is no repeller of His bounty. He causes it to reach whom He wills of His servants. And He is the Forgiving, the Merciful. Say, "O mankind, the truth has come to you from your Lord, so whoever is guided is only guided for [the benefit of] his soul, and whoever goes astray only goes astray [in violation] against it. And I am not over you a manager." And follow what is revealed to you, [O Muhammad], and be patient until Allah will judge. And He is the best of judges. Surat Yunus 10:107-109
All of life, whether characterized by suffering or ease, is a test from the Most Merciful Allah, seeking an obedient and grateful response. Suffering is intended to humble us, so that we submit to Allah. Those who respond to suffering with obstinance, will be punished according to this behavior.
And We have already sent [messengers] to nations before you, [O Muhammad]; then We seized them with poverty and hardship that perhaps they might humble themselves [to Us]. Al-Baqarah 2:214
Or do you, [O Muhammad], ask them for payment? But the reward of your Lord is best, and He is the best of providers. And indeed, you invite them to a straight path. But indeed, those who do not believe in the Hereafter are deviating from the path. And even if We gave them mercy and removed what was upon them of affliction, they would persist in their transgression, wandering blindly. And We had gripped them with suffering [as a warning], but they did not yield to their Lord, nor did they humbly supplicate, [and will continue thus] Until when We have opened before them a door of severe punishment, immediately they will be therein in despair. And it is He who produced for you hearing and vision and hearts [i.e., intellect]; little are you grateful. And it is He who has multiplied you throughout the earth, and to Him you will be gathered. And it is He who gives life and causes death, and His is the alternation of the night and the day. Then will you not reason? Rather, they say like what the former peoples said. They said, "When we have died and become dust and bones, are we indeed to be resurrected? We have been promised this, we and our forefathers, before; this is not but legends of the former peoples." Say, [O Muúammad], "To whom belongs the earth and whoever is in it, if you should know?" Surah Al-Muminun 23:72-88
Surah Al-Mu-minoon recitation in full with English subtitles
At the same time, Allah offers mercy and forgiveness to those who respond to suffering and blessing with gratefulness and humility. For example, the Prophet Job (peace be on him) was tortured with hardship by devils, and Allah relieved his suffering:
If Allah gives us plenty rather than poverty in this life, we are responsible to share it generously with those who have less. This is one way in which the wealthy can pass their test.And [mention] Job, when he called to his Lord, "Indeed, adversity has touched me, and You are the most merciful of the merciful." So We responded to him and removed what afflicted him of adversity. And We gave him [back] his family and the like thereof with them as mercy from Us and a reminder for the worshippers [of Allah]. Al-Anbiya 21:83-84
Or do you think that you will enter Paradise while such [trial] has not yet come to you as came to those who passed on before you? They were touched by poverty and hardship and were shaken until [even their] messenger and those who believed with him said, "When is the help of Allah?" Unquestionably, the help of Allah is near. They ask you, [O Muhammad], what they should spend. Say, "Whatever you spend of good is [to be] for parents and relatives and orphans and the needy and the traveler. And whatever you do of good – indeed, Allah is Knowing of it." Surah Al-Baqarah 2:214-215
Let a man of wealth spend from his wealth, and he whose provision is restricted – let him spend from what Allah has given him. Allah does not charge a soul except [according to] what He has given it. Allah will bring about, after hardship, ease [i.e., relief]. Surat At-Talaq 65:7
And obey Allah and the Messenger that you may obtain mercy. And hasten to forgiveness from your Lord and a garden [i.e., Paradise] as wide as the heavens and earth, prepared for the righteous Who spend [in the cause of Allah] during ease and hardship and who restrain anger and who pardon the people – and Allah loves the doers of good; Surat Ali Imran 3:132-134
There are countless statements and stories of guidance in Quran and Hadith concerning the purpose and reward for our suffering. Allah is all-Merciful and does not intend to increase hardship for us needlessly. On the authority of Ali (may Allah enable his countenance), the Messenger of Allah (may the peace and blessings of Allah be upon him) said, “Whoever increases in asking forgiveness, Allah will make relief from him from every worry, a way out from every hardship, and provision from where he does not even imagine.”
Narrated Abu-Huraira (May Allah be satisfied with him): ‘Allah’ Messenger (May Allah exalt his mention and protect him from imperfection) said: “Allah says: ‘I am just as My slave thinks of Me, (I am Able to do for him what he thinks I can do for him) and I am with him if he remembers Me. If he remembers Me in himself, I too remember him in Myself, and if he remembers Me in a group of people I remember him in a group that is better than his, and if he comes one span nearer to Me I go one cubit nearer to him, and if he comes one cubit nearer to Me I go a distance of two outstretched arms nearer to him, and if he comes to Me walking I go to him running.’ (Bukhari)