[Jacques Daret, The Visitation, from the Arras Altarpiece. The man on the left is a portrait of the donor.]
In those days Mary set out and went with haste to a Judean town in the hill country, where she entered the house of Zechariah and greeted Elizabeth. When Elizabeth heard Mary’s greeting, the child leaped in her womb. And Elizabeth was filled with the Holy Spirit and exclaimed with a loud cry, “Blessed are you among women, and blessed is the fruit of your womb. And why has this happened to me, that the mother of my Lord comes to me? For as soon as I heard the sound of your greeting, the child in my womb leaped for joy. And blessed is she who believed that there would be a fulfillment of what was spoken to her by the Lord.”... And Mary remained with her about three months and then returned to her home.
[Luke 1:39-45, 56 NRSVCE]
Luke tells us that after she learned that she was pregnant with John, Elizabeth remained in seclusion for five months and that the Annunciation to Mary occurred in the six month, after which Mary visits Elizabeth "with haste", so this indicates that at the Visitation Jesus would have been early in his first trimester and John at least early in his third, which, of course, is why Mary stays for "about three months".