Mollies, like the other livebearing fish ( Platies, Guppies, Swordtails), can hold sperm for later impregnation so you will never know when the fish got pregnant unless you know the first time the fish was in a tank with a male. So the " when" does not really matter. The best thing to do with a pregnant Molly is place her in a tank with lots of floating plants or fine leaved plants that the fry can hide in when they are born. Mollies can suspend the birthing of their fry until they feel secure that the fry have a chance of living so unless you have that type of set up that she is in already, she may not birth in the tank. If the tank is large enough, you can also place a divider in the main tank and keep the female on one side until she gives birth. Once she's had the fry, she can be placed back with the male. Once the fry are large enough to not get eaten by the other fish, the divider can either come out or the fry can be placed on the other side and when the female gets ready to birth again, she can be placed on the other side again. As for plant types, I've used live plants for this as well as plastic plants for this. I'm currently using floating plastic Anacharis for Gambusia which are notorious for eating their own fry. I am currently working with a 3rd generation of these fish so the plants must have helped as there are no other places for the fry to hide in this tank.
Hope this helps.