A sense of humor can differ from one person to another. Since sarcasm is one form of humor, some people may not be able to understand it.
Some people find sarcasm offensive and not funny, which is why their brains may sometimes block it. See Why sarcasm is bad
If a person is sensitive or emotional, they may not be able to comprehend the intention behind the sarcastic comment, which could in turn hurt their feelings.
Sarcasm sometimes needs a high level of intelligence to be understood, which some people may not have.
Anti-social people may not understand sarcasm as a result of not engaging in regular social interactions.
Socially awkward people may dislike sarcasm, as it increases their feeling of awkwardness in social gatherings.
If a sarcastic comment is said in a serious tone, the recipient may not differentiate between it and normal talk.
Sarcastic comments are sometimes said by using outside references from books, movies or TV shows, which makes it hard for a person to understand them if they're not familiar with the reference.
Some people may not understand sarcasm if it's not in their culture.
People who never use sarcasm in their talk and always adopt a serious tone may find it hard to understand sarcastic comments when they are said.
When someone is being mean to a person, the person might choose to block out the mean things that are said to them, which might prevent them from understanding sarcasm.
Younger age groups and seniors may not understand sarcasm if they've never been exposed to it before or if it wasn't in their culture back in their day.