Job is one of my faves!
I'll tell you what a Jehovah's Witness had to say about your question. I don't agree with them about alot of things, but in this instance it made plenty of common sense.
According to the book of Job, Satan was flying to and fro between the earth and heaven. He would come before God and the angels and say that the only reason Job worshiped him is because he was blessed with wealth, a large family, good health, etc. So God allowed Satan to inflict suffering onto Job by taking away all that he had, until Job sat there in the dirt scraping maggots off his wounds.
Job lived a very long time ago, back when God blessed those who were good, and cursed those who were not. Job was a good and upright man, so he didn't understand why all of this tragedy had come upon him. Despite it all, he would not curse God.
Behind the scenes though, you have Satan challenging God in front of the angels. Basically he's saying that man will only serve God when it benefits him, but God wanted to prove him wrong, and he did this through Job. He could have just told Satan that he was wrong, but then the doubt would have lingered with the angels. Remember, Satan got too big for his britches and was eventually cast from heaven forever, but at the time of Job, according to the bible, Satan was still allowed to go back and forth between the earth and heaven and stand in God's presence.
Anyway, Job, without knowing what was going on behind the scenes, proved that man can and will worship and serve God regardless of any personal gain, and this story left no doubt of this among the angels.
It also helps to understand why bad things happen to good people.
Wouldn't God know what satan was going to do also?