So it was to teach him a lesson. Ok thanks
Your comment suggests that God made Job suffer. That is not what happened, according to the text.