It's amazing to me just how insensitive Job's friends were to his situation. I can't imagine suggesting to one of my friends that his sin was responsible for the death of his children – especially when there was no solid evidence for such a statement.
Job's friends simply assumed that Job must have done something wrong to be facing the crisis he was facing. Since God is just, from their perspective He was certainly punishing Job for sinful behavior (perhaps similar to the flood or Sodom and Gomorrah). This would be the equivalent of saying that God sent Hurricane Katrina to cleanse New Orleans because of its immorality. These types of insensitive comments forget the fact that, while God is holy and just, He is also loving and merciful. He never ceases to be loving so He can be just, and He never ceases to be just so He can be loving. God is, at once, all of these things and more.
Job's friends made the mistaken assumption that what they were observing from the outside was indicative of what was going on on the inside. This, however, was not the case. Job was blameless before God. We must also be careful about counseling others through grief. There are certainly times to speak truth, but there is also a good lesson here about speaking haphazardly.