First of all, through difficult experiences, the Lord teaches us endurance. Our natural reaction to pain is oftentimes to run in the opposite direction—and as fast as possible. However, God wants us to "hang in there" so that we can derive the full benefit of whatever lesson He has for us.
Second, the heavenly Father uses trials as a refining fire to purify His children and bring them to greater spiritual maturity. He has a plan for each believer, and hardship is one of the tools necessary to prepare us to do His will. In the process, we will find that our faith has been strengthened.
As we realize God brings benefit from our adversities, we'll begin to face challenging times with confidence that He always has our best interest in mind. This leads to joy, because we know He is building our endurance, purifying our hearts, and making us people with unshakeable trust in Him.
Servant of The Lord