I watched a video a couple years ago where they did an experiment with chimps. I thought they concluded that the "cantagious" yawning has to deal with the animals empathy and wanting to be like others, it was a social thing in pretty sure. I have no idea where to even find this video though so take that with a grain of salt