Contagious yawning is observed in many mammals, but there is no such report in human babies. Whether babies recognize yawning is an unanswered question.
source https://www.lifetechnology.com/blogs/life-technology-news-blog/do-babies-like-yawning-evidence-from-brain-activity