According to Discovery News, contagious yawning results from primal instincts rooted in the human capacity for empathy and for building unconscious emotional links with others. Yawning when other people yawn is similar to laughing or crying when others do, in that it promotes social bonding.
Discovery News states that people begin yawning after other people do at about 4 years of age. People with severe autism never pick up contagious yawning, with autistic people in general being around half as likely as the general population to pick up the behavior and show evidence of having developed unconscious emotional links to other people. According to Discovery News, studies show that people do not yawn to bring in more oxygen, as many people think. The cause of spontaneous yawning is not known.