Lily is already in the hospital room with the rest of the family but then later she can be seen entering after Cameron and Mitchell.
Although it is shown here that Cam & Mitch were the first people to know about Haley & Dylan's pregnancy, it is clear to see in previous episodes that they were not the first people to know. Haley first revealed it to Alex & Luke in S10E09.