It is true that you do not ovulate when you are having your period. However, women with irregular cycles or short cycles can ovulate during their periods. Also, the sperm can survive for nearly five days within the female reproductive canal. Even if a single sperm survives, it is enough to fertilise an egg.
Also Read: 8 Wonderful Things Shahid Has Done After His Wife Mira Rajput's Pregnancy