If you have sex right before your menstrual cycle period, you will be unlikely to get pregnant, but it is not impossible either. Generally, most of the women have 28 days of menstrual cycle, but in some women, the menstrual cycle can be from 21 to 45 days and this is also normal.
You can get pregnant only during a narrow window of five to six days in a month. When exactly these fertile days occur depends on when you ovulate, or release an egg from your ovary.
It is possible to ovulate earlier or later, even for people with regular menstrual cycles. This can replace the fertile window by a few days in a month. In other words, it is difficult to pinpoint a time in your menstrual cycle where you can be 100 percent guaranteed that you will get pregnant or not.