The familiar phenomenon of yawning has been observed in every single class of vertebrates (mammals, birds, amphibians, bony fish, etc.).

Yep, frogs yawn

This indicates that the evolution of yawning began very long ago in the biological time line. Scientists speculate that yawning is perhaps used for empathy socialization.