If I respond, it is because there is some empathizing going on. In other words, I'm sincere. This could be due to me feeling bad about one's plight, recognizing myself in another's struggle, or recognizing that no man is an island and that the bell tolls for me, etc.
It also helps me deal with issues I'm dealing with, either because I feel that others (unfortunately) do have it worse, have similar experiences, or rejoice that others have experiences that I have had and I can show them there is light at the end of those particular tunnels. It helps me connect, balance out some more... introspective aspects of my life.
Of course, that's me. I have my quirks (like a near-absolute-refusal to talk about anything bad in MY life) and I can not say that there are not some people who are "sorry" merely because they feel they "ought to be" instead of from any such actual empathy. And I'm all right with that.