Recently studies showed that cow mastitis seriously affected the economic benefit of dairy industry and pathogen infection including S. aureus is the main cause of mastitis. However, there is still a lack of safe and effective treatment for S. aureus-induced mastitis due to its complex pathogenesis. Endogenous retroviruses (ERVs) have long been symbiotic with mammals, and most ERVs still have the ability to produces complementary DNA (cDNA) by reverse transcription, whose induction by commensal or pathogens can regulate host immunity and inflammatory responses through the cGAS-STING pathway. However, whether and how ERVs participate in the pathogenesis of S. aureus-induced mastitis still unclear. In this study, we found that S. aureus treatment increased the levels of ERVs and IFN-β. Inhibition the transcription of ERVs by emtricitabine alleviated S. aureus-induced mammary injury, reduced mammary bacterial burden, and inhibited the production of mammary proinflammatory factors including TNF-α, IL-1β and MPO activity. Moreover, inhibition of ERVs restored the function of blood-milk barrier caused by S. aureus. Next, we showed that S. aureus infection activated mammary cGAS-STING signaling pathway, which was mediated by ERVs, as evidenced by emtricitabine inhibited S. aureus-induced activation of the cGAS-STING pathway. Interestingly, inhibition of cGAS-STING by Ru.521 and H151 respectively, significantly alleviated S. aureus-induced mammary injury and inflammatory responses, which was associated with the inhibition of NF-κB and NLRP3 signaling pathways. In conclusion, our study revealed that ERVs regulate the development of S. aureus-induced mastitis in mice through NF-κB- and NLRP3-mediated inflammatory responses via the activation of cGAS-STING pathway, suggesting that targeting ERVs-cGAS-STING axis may be a potential approach for the treatment of S. aureus-induced mastitis.