Cyclic guanosine monophosphate (GMP)-adenosine monophosphate (AMP) (cGAMP) synthase (cGAS), along with the adaptor stimulator of interferon genes (STING), are crucial components of the innate immune system, and their study has become a research hotspot in recent years. Many biochemical and structural studies that have collectively elucidated the mechanism of activation of the cGAS-STING pathway with atomic resolution have provided insights into the roles of the cGAS-STING pathway in innate immunity and clues to the origin and evolution of the modern cGAS-STING signaling pathway. The cGAS-STING pathway has been identified to protect the host against viral infection. After detecting viral dsDNA, cGAS synthesizes a second messenger to activate STING, eliciting antiviral immune responses by promoting the expression of interferons (IFNs) and hundreds of IFN-stimulated genes (ISGs). Recently, the cGAS-STING pathway has also been found to be involved in response to bacterial infections, including bacterial pneumonia, melioidosis, tuberculosis, and sepsis. However, compared with its functions in viral infection, the cGAS-STING signaling pathway in bacterial infection is more complex and diverse since the protective and detrimental effects of type I IFN (IFN-I) on the host depend on the bacterial species and infection mode. Besides, STING activation can also affect infection prognosis through other mechanisms in different bacterial infections, independent of the IFN-I response. Interestingly, the core protein components of the mammalian cGAS-STING signaling pathway have been found in the bacterial defense system, suggesting that this widespread signaling pathway may have originated in bacteria. Here, we review recent findings related to the structures of major molecules involved in the cGAS-STING pathway and the effects of the cGAS-STING pathway in various bacterial infections and bacterial immunity, which may pave the way for the development of new antibacterial drugs that specifically kill bacteria without harmful effects on the host.