They are close friends
Close friends oftentimes copy the body language of each other. The copying happens on the unconscious level and the people won’t be aware that they are copying each others’ moves.
When they feel that someone is familiar
If a person feels comfortable around someone, they might automatically copy their moves due to familiarity.
When a person becomes interested in someone
When a person becomes interested in someone, they might mirror their moves unconsciously without noticing. (See Why some people are not interested in others?)
When they have a certain level of attachment to the person
When a person has a certain level of attachment towards another by being good friends, for example, then they might unconsciously copy their gestures.
Copying happens because of mirror neurons
Mirror neurons, or the cells inside the brain that allow us to empathize, are responsible for the act of copying others.
Experts do it intentionally
NLP practitioners and body language experts can copy others intentionally because they understand that copying others can help create an atmosphere of familiarity and friendliness. (See Why do we like familiarity?)
They want to get closer to that person
If a person wants to get closer to someone, they might unconsciously mimic their moves, gestures and even tone of voice to sound more familiar to them.
When they empathise with a person
When a person feels strong empathy towards someone, they might automatically mirror their gestures or body language.