Humans evolved living in social groups.
You get sick when someone else vomits, because there's a chance you ate the same food and you want to get the poison out of your system.
Yawning is similar, when one person is sleepy, everyone else should probably go to sleep too because even if you don't want to admit it, you're probably tired.