This is a great question. Unfortunately, there's no solid answer.
My personal answer/opinion is that it was to spite Satan. Satan wants nothing more than to steal the souls of man. He will do whatever it takes. He knows our weaknesses and our strengths, and he will do whatever it takes to use them against us. I believe that's why God was "bragging" about Job in the first place to show Satan that he can't always win. With freewill and living in a fallen world, we aren't promised easy or good. So, He allowed Satan to test Job, but when the testing was over, God blessed Job x2. I am sure He also protected Job from Satan's hand after all that.
God would later use Job's example of faithfulness and the goals of Satan to show all the generations to come how hard we must fight. We are expected to stay faithful no matter what, and one day, we will be rewarded for that. Until then, we aren't promised anything. (The book of Ecclesiastes answers a lot of questions based around: Why do bad things happen to good people?)