I have ridden my bike despite having my period numerous times already. I guess being active helps in relieving the symptoms of dysmenorrhea that I have, it's pretty mild though. But if it's during the second day of my period, I try to avoid riding just because it's the heaviest day for me. Otherwise, during the first and third day, it's fine for me as the flow during these times aren't that heavy.
The only other thing that I'd take into consideration is the heat. I live in a tropical country and having my period adds to that heat. So if it's particularly hot, I'd skip riding my bike. It can feel gross and too uncomfortable, at least for me.
With regards to pregnancy, it would be wise to consult your doctor. Basically, some pregnancies are high risk and it's better to avoid biking for these women. But some doctors don't advice against it especially if you have been biking a lot before your pregnancy.