This is something that people say when they realize that there's a problem and are suddenly worried.
"Shit" is a curse word, so there are a lot of situations in which it isn't polite to say it:
- around strangers
- to people who you are trying to impress, like your boyfriend or girlfriend's family
- in church
- if you're a child
There are some people who don't say words like "shit" at all. But most people do use curse words with their close friends and sometimes coworkers.