It's an expression used when someone wants to demonstrate a deep sadness.
Ex: Karen's cat was run over and his leg broke. What a pity!