"My son, peace be unto thy soul; thine adversity and thine afflictions shall be but a small moment; and then, if thou endure it well, God shall exalt thee on high; thou shalt triumph over all thy foes." D&C 121:7-8
Through our adversities we can become exalted, which means living with God forever.
"The very opportunity for us to face adversity and affliction is part of the evidence of God's infinite love. God gave us the gift of living in mortality so that we could be prepared to receive the greatest of all gifts of God, which is eternal life." - President Henry B. Eyring
The Plan of Salvation was created by God for a couple of reasons:
1) to gain a body
2) to be tested
Our test is adversity.
In my all-time favorite book, Enders Shadow, a nun named sister Carlotta is talkign with another chraceter from the book. She says, "Do you knwo why Satan is so angry allt he time? Because whenever he works a particularly clever bit of mischeif, God uses it to serve His own righteous purposes."
When I was younger I wondered why God didn't just get rid of Satan. Throughout the years I have learned that we need adversity, we need Satan to be tested. I imagine it like this:
Sometimes, if we get too close to the dog, our cuts might be a little deeper and they might scar. God uses those scars as a reminder of our mistake and so we don't do those things again.
God is the holder of the leash, the nurse that heals our wound, and the parent that loves us through our pain.