The story of Job gives us wonderful insight into a situation where the reader actually understands why God is doing something (because the writer tells us) however Job and his friends and family do not know why. What a wonderful opportunity to see there is more to situations than just what appears to us! Now specifically, we see that God gives the go-ahead to Satan to cause all of this suffering on Job. He is given the green light to inflict on Job whatever he wishes, with the exception of death to Job. Other than that, he is free to inflict as much damage, pain, and suffering as he likes. As anyone who is familiar with the story knows, the Devil does a masterful job of destruction. But the point here is that God allowed it all to happen.