Hardship makes one turn humbly toward one's Lord. Someone once said, "How Perfect is Allah, Who has elicited supplication through hardship." It has been related that Allah tested one of His slaves in a matter and then said to the Angels that it was, "In order to hear his voice," meaning his supplications and invocations.
Hardship instills humility in the heart of the afflicted:
(Nay! Verily, man does transgress all bounds [in disbelief and evil deeds, etc.], because he considers himself self-sufficient.)
(Qur'an 96: 6)
People give comfort to, and pray for, the afflicted. Thus during times of hardship the believers come together in a spirit of brotherhood.
Hardship should make one grateful for having been saved from that which is greater than the hardship with which he was afflicted.
Furthermore, hardship atones for sins. When the slave of Allah gains an appreciation of these facts, he will be thankful.
(Only those who are patient shall receive their rewards in full, without reckoning.) (Qur'an 39: I0)