This is what researchers call when we mimic the expressions and the emotions of the people around us.
The phrase "misery loves company" is a widely-used term and it seems that there is truth behind the phrase. Emotional contagion happens because of the mirror neuron system. Our neurons fire up when we behave in certain ways and is a probable explanation for how we experience empathy towards others.
MORE LIKE THIS
Emotional Contagion: The Social Power of Emotions Explained
How to Read Body Language and Facial Expressions