I’ve never had this happen to me before, so I don’t want to give you wrong advice. I have definitely experienced severe cramping though. I think I would note the symptoms you have before you faint (like nausea or cramping, etc.) and then take that information to your healthcare provider. They could give you the best answer to that and run any necessary tests if need be. Also, make sure you check out Dr. Molly’s response to this question. She probably has a lot more insight on the subject than I do!
I've had a lot of not-so-desirable symptoms with my period, but fainting isn't one of them. However, I've been known to pass out on occasion, so I know how unpleasant and scary fainting can be. Those first few minutes after you come to are so disorienting, aren't they? I have heard of girls feeling faint or actually fainting during menstruation, and I'm sure Dr. Molly will have the medical scoop on why it happens. As far as making it stop, I think you need to speak to your healthcare provider. He or she will be able to ask follow up questions and really get to the bottom of your fainting spells.
I’ve got two suggestions for you: first drink a ton of water in the few days leading up to your period so your tank of blood is as full as it can be making fainting much less likely. Second: take ibuprofen (following the package directions or your health care provider's advice) three times a day for the couple of days before your period to decrease the amount of prostaglandins floating around in your system that are causing you to feel faint. Prostaglandins are released in the two to three days before your period comes and can wreak havoc with your system and some women even faint as a result. Take some ibuprofen and drink a ton of water and see if it helps. Good luck!
This is not intended to be medical advice. Everybody is different so please make sure to consult your physician if you're having issues. Do not delay or refrain from seeking professional medical advice from your physician because of something you have read on this site.