Probiotics work by changing the composition of your gut bacteria or the metabolic activity of existing bacteria. The good bacteria crowd out the bad in your intestine. This prevents the bad bacteria from multiplying and causing infection or inflammation. For example, too much yeast in the body can lead to yeast infection, but the well-balanced gut biome will keep yeast at lower levels.
Probiotics may help your digestion and enable your body to extract nutrients from your food. Good bacteria may also produce enzymes or proteins that inhibit, or even kill, harmful bacteria. Specific strains of probiotics also stimulate your immune system. Some bacteria are necessary for hormone production or vitamin (e.g., vitamin K) and nutrient absorption.
Citation from healthline.com