Because humans are social animals. In a foraging group when one person sleeps, the others need to synchronise so that the pack functions effectively. Hence yawning. as a sign of sleepiness, is as much a signal to pack members as it is a physiological function. Ring tailed lemurs and chimps also do this.
Yawning has the effect of increasing the oxygen content in the lungs; in a tired person this results in a temporary respite from the onset of sleep. However, a yawn might also signify a low oxygen level in the air, thus requiring a larger intake of breath to get a decent level of oxygen. Psychosomatically, the other people pick up on this and they too yawn, 'in case,' the instintive part of the brain thinks, 'there really is a lack of available oxygen...'
I read recently that the 'increasing oxygen' argument has been discounted by scientists becauses foetuses yawn in the womba, although they are not breathing oxygen. They do err on the side of social behaviour though - one theory is that a tribal member may be bearing his teeth at a perceived enemy, and others automatically do the same to advise the intruder that the potential trouble will be multiple, and this has remained in our 'civilised' society.