|William Blake portrays God speaking to Job in a whirlwind|
Some people think the lesson is simple: do not question the ways of God. When bad things happen to good people, trust God and never question His ways. He controls the universe, and you are a speck of dust.
True. But instead of God teaching us a lesson, Karl Jung (psychologist) believed that Job also taught God a lesson, a lesson that God could not teach Himself. The lesson was about moral perfection: that to be truly good, one must do the right thing in the face of horrible, unjust suffering. But God cannot suffer. One must have free will, something God might not have. For God to evolve, to become better, to become more loving, God confronts a morally perfect human (Job) and realizes that the limitations inherent in man are actually the most beautiful thing about us. What does God take away? Love, forgiveness, and sacrifice. Jesus, of course, will become for Christians the ultimate confirmation of the Book of Job: God becomes man in order to perfect love. The Trinity is complete.
Personally, this all makes some sense to me, even though this interpretation is controversial at best. (Quick interpretation tip inspired by Augustine: if an interpretation increases your love and understanding, it's probably right). Imagine God before the universe, before anything existed. God, all by himself, has limitations. God needs creation and creation needs God. Otherwise why would God create to begin with? Everything is a reflection of God and a part of God. Human beings are not all-knowing or all-powerful - we are not even close. But, because of free will, we have the potential to be perfectly good. Job and Jesus are good examples of that.
True Love is Freely Given
Here's another way to think about it. God could have designed the world in a purely rational way, where good people are blessed and bad people are punished. In a way that makes sense. But is that love? True love, unconditional love, is freely given. It looks beyond circumstances and just is. Perhaps the Book of Job is a justification for why God must allow good people to suffer: it's the only way to love freely, both the good and the bad.