Ideally the ovulation occurs around the 14th day of the cycle in a regular period cycle. So obviously the egg is viable for 2 to 3 days and you cannot get pregnant just 2 days prior to the period. But this is possible only if your periods are regular. Those girls who have very irregular periods, they will not know which is the two day prior to the period unless they get their next menstrual cycle. So if you are 40 or 45 day cycle, you can ovulate as late as 20th or 25th day of the cycle. So on that day, on the 25th day it becomes unsafe because, it is just 2 days prior to a 28 day cycle and if you are not using a contraceptive, you can get pregnant at that time.
View source by clicking here.