The joke is a pun on the word 'maternity'. 'Maternity' means motherhood. It sounds like 'eternity' which means forever.  The pregnancy is very long so it feels like an eternity.
Sometimes a pregnancy is so long it seems like a maternity .