Although theoretically ovulation occurs 14 days before the period, sometimes, when the cycles are irregular or short, ovulation occurs at the same time as the previous period, so, although it is rare, there are pregnancies that occur during menstruation.
Most women's menstrual cycles last 28 days, but others have shorter cycles and therefore may ovulate before the end of menstruation. The shorter the cycle, the closer ovulation and menstruation are, and therefore, pregnancy could occur. If we add to this the fact that the sperm remain in the female reproductive tract for 3 to 4 days, fertilization can occur.
The same can happen with those women who have irregular cycles, since it is difficult to predict the moment of ovulation. There are also women who ovulate early, on the 10th day of the cycle instead of the 15th, always counting on 28-day cycles. Thus, it is possible that they can become pregnant if they have unprotected sex during their period. In addition, the chances increase if the period lasts a week or more.
If you want more information about the possibility of pregnancy with menstruation access this article: Can I get pregnant while on my period?