Oxford Online Dictionary has the following definition:

Feeling sad or distressed through sympathy with someone else’s misfortune: I was sorry to hear about what happened to your family

Online Etymology Dictionary states that the word was used in Old English that means:

Old English sarig "distressed, grieved, full of sorrow" (not found in the physical sense of "sore")...Apologetic sense (short for I'm sorry) is attested from 1834; phrase sorry about that popularized 1960s by U.S. TV show "Get Smart." Related: Sorrily; sorriness.

It doesn't mean someone is apologizing for anything. He is just feeling sympathy (or sorrow/pity) for what happened to you.