It's completely involuntary, we do it even before we are born and boredom and drowsiness can be the cause but it's also a social thing. Hense the whole yawn chain thing.
I also read somewhere that it's a mini orgasm, but I'm sure I had dodgy sources, so lets not go into that...
We often yawn in groups so maybe it's something to do with excess carbon dioxide?
Ok I'll admit I have no idea, it's interesting though.