It is not clearly proven that yawning is contagious in other species than humans. All humans yawn, but no one knows why. There are many theories, but no one knows for sure why we yawn.
Thanks for the answers! Geir Bjorklund there is one theory, lack of oxygen. Thx again for the answers, it s maybe a silly question but it s good to know the answer!
We do not now, why anybody yawns... But we do know, that - probably because of mirrow-neurons - we can feel the same things as our counterpart does. So, if I see s.o. eat, I´d like to eat myself. If I see s. o. laugh, at least I smile, too. Mirrow-neurons excite the same regions in the brain that are excited in the person in front of us. So we yawn, if s. o. yawns, even if it´s a dog. This is called the "Carpenter-effect". See:
In my animal behaviour class taught by a well known ethologist, Jane Brockmann at the University of Florida, we were taught that yawning is a learned behaviour and that it could be learned across species! This was in 2003 so things may have changed but I always thought that this was interesting.