It's not a good idea to keep a tampon in if you're having vaginal sex. The guy's penis may push the tampon in further, and you might have trouble removing it afterward. So always take a tampon out before having sex.
There is one thing you should use if you have sex during your period, though: a condom. A girl can still get STDs during her period and she can still get pregnant then too. So protect yourself!