Is it ok to have sex during period?

I don't know why but when I'm on my period that's when I want to have sex.  Is it ok? Especially just before my period and during the last 2days, I feel the need to is it safe if I do?