The age old question of צדיק ורע לו ורשע וטוב לו, or, why do bad things happen to good people, while the wicked prosper, is dealt with in מסכת ברכות.
The term used in the Gemara is יסורים, or suffering. There is a lengthy discussion of the subject with a Pasuk from Mishlei quoted, saying that Hashem rebukes only the ones he loves. While this is little consolation for one who is going through a serious illness or loss of money, there is still a lesson to be learned.
We are taught to believe that everything Hashem sends our way is for our ultimate good. Either He wishes for us to repent, or He desires to give us greater reward in the manner in which we accept that which we are forced to deal with.
It is difficult to give absolute answers to this question of why good people suffer. However, one thing is clear from the Gemara’s discussion. No matter how trying and uncomfortable the situation is, we must never become negative or bitter or full of self pity. If we can overcome this, in the end we will certainly realize that everything we were confronted with was for our benefit. And we will be rewarded greatly for this acceptance.