The actress, 29, debuted her baby bump at CinemaCon in Las Vegas on Monday while promoting Teenage Mutant Ninja Turtles: Out of the Shadows.
And while some questioned who the father might be given the couple's recent split, a source with knowledge of the situation tells PEOPLE, "of course Brian is the dad! They never stopped loving each other and they will never stop being devoted parents to their boys."
Charley Gallay / Wireimage
The pregnancy came as a surprise for the couple who are "very excited" and are "continuing to work on their marriage and are living together again," says another source.
The New Girl star filed for divorce in August after five years of marriage and 11 years together. According to legal filings, the divorce is still pending.
Reps for both stars have not commented.
The couple, who are already parents to Noah, 3½, and Bodhi, 2, are back together and while Megan has been busy working on Teenage Mutant Ninja Turtles, Brian has stayed with their boys.
"They both love being parents," adds the source.
The exes have remained amicable since announcing their split and have often been spotted together with their two children and have also been seen running errands together without the kids.