Bacteria have the same problem as most protists-- water tends to flow into them. Depending on the solute levels in the environment, the bacteria will either stockpile or actively get rid of salts inside the cell like potassium and sodium. Because the bacteria changes based on its environment, it is an osmoconformer
If there is a higher solute level outside of the cell, the bacteria will stockpile salts to attract water.
If there is a higher solute level inside the cell, the bacteria will pump out salts, leading water to diffuse towards the higher salt concentration outside the cell