According to Shemos Rabba 1:13, Yocheved was three months pregnant with Moshe when Amram divorced her.
רבי חנינא בר רב יצחק אמר: שפרה, שהעמידה ישראל לאלהים, שבשבילם נבראו השמים, שכתוב בהם (איוב כו, יג) ברוחו שמים.
שפרה, פועה, שהופיעה פנים כנגד אביה, שהיה עמרם ראש סנהדרין באותה שעה, כיון שגזר פרעה, ואמר (שמות שם, כב) כל הבן הילוד.
אמר עמרם: ולריק ישראל מולידים?!
מיד הוציא את יוכבד ופרש עצמו מתשמיש המטה, וגרש את אשתו כשהיא מעוברת משלשה חודשים. עמדו כל ישראל וגרשו את נשותיהן.
That is why they were able to keep Moshe for three months. The Egyptians began counting from the time of the remarriage. See Sotah 12a, and as understood by The Midrash Says (page 17).
Sotah 12a states:
She hid him three months.29 [She was able to do this] because the Egyptians only counted [the period of her pregnancy] from the time that she was restored [to youth], but she was then already pregnant three months.
'Restored' could mean to youth or to her husband. But regardless, this might also assume that she was pregnant before the separation.
Why, then, divorce? A good separate question. Among many answers, one could say that this was just as a role model for the other Israelites to follow.
I'll also note that we don't need to absolutely assume that even within the midrashic realm, everyone agrees to this. Indeed, I think there is possibly a slight difference even between this Midrash Rabba and the gemara in Sotah.
According to Targum (Pseudo-)Yonasan, Yocheved had Eldad and Medad with another man when she was divorced from Amram, in which case she was decidedly not pregnant with Moshe from before.