Various problems and obstacles are encountered during pig farming, especially the weaning phase when switching from liquid to solid feed. Infection by pathogenic bacteria causes damage to the intestinal barrier function of piglets, disrupts the balance of the intestinal microbiota, and destroys the chemical, mechanical, and immune barriers of the intestinal tract, which is one of the main causes of gut inflammation or gut diseases in piglets. The traditional method is to add antibiotics to piglet diets to prevent bacterial infections. However, long-term overuse of antibiotics leads to bacterial resistance and residues in animal products, threatening human health and causing gut microbiota dysbiosis. In this context, finding alternatives to antibiotics to maintain pre- and post-weaning gut health in piglets and prevent pathogenic bacterial infections becomes a real emergency. The utilization of probiotics in piglet nutrition has emerged as a pivotal strategy to promote gut health and defend against pathogenic infections, offering a sustainable alternative to traditional antibiotic usage. This review introduces recent findings that underscore the multifaceted roles of probiotics in enhancing piglet welfare, from fortifying the gut barrier to mitigating the impacts of common bacterial pathogens. Meanwhile, this study introduces the functions of probiotics from different perspectives: positive effects of probiotics on piglet gut health, protecting piglets against pathogen infection, and the mechanisms of probiotics in preventing pathogenic bacteria.