“Can you transmit or get any STDs from having sex when you are on your period?”
Yes, you can both get and give an STD, including HIV, when you are on your period.
Side note: It is also a myth that you cannot get pregnant when on your period.
Using condoms consistently and correctly is the only way to prevent STD transmission if you’re sexually active. Regular STD checkups can help as well if you have more than one sex partner, since condoms don’t protect all the way from all the STDs, and many STDs don’t have symptoms.