You can have intercourse before your period. However, if you have had a miscarriage or other uterine surgery, and your doctor’s advice is that you should not have sex until after your next period, you should not have sex before you have your period.
Before your period, as long as there is no vaginal bleeding, you can have sex normally, but if you have your period during sex, you need to stop immediately. If you have your period during sex, you need to stop right away and have sex again after your period clears.
If you have had an abortion or other uterine surgery, and the doctor’s advice tells you that you can’t have sex before your next period, you need to follow the doctor’s advice and have sex after your period clears and is reviewed.
Sexual intercourse is prohibited after menstruation because the endometrium is shedding and sexual intercourse can easily lead to endometrial inflammation, adenomyosis, endometriosis, and so on.