This is due to the bacteria translocation phenomenon from gut to vagina (as in urinary tract infections, for example, bacteria move from one level to another).

The newly arrived bacteria in the vagina will be able to rebalance the flora there with good bacteria.