"Feeling sorry for" someone means that you feel bad because they feel bad, or because they're in a difficult situation.
For example, you can "feel sorry for" a person who:
- was just broken up with by a boyfriend or girlfriend
- got fired
- has never had a chance to eat your favorite dish
and so on.
Grammatically, you can use this phrase in these ways:
I feel sorry for them.
I feel sorry for them having to work so late.