Osmosis works across every cell membrane along a concentration gradient as its a physico-chemical principle. Water can cross the membrane (or cell wall), while the substance dissolved in it (for example salts) can not. Because eukaryotic cells only have a cell membrane, they will burst eventually, while bacteria (and also plant cells) have a more rigid cell wall, which will mostly prevent bursting. However the influx (or outflux) of water creates a pressure which is called turgor pressure. How this works is shown below (figure from here), bacterial cells and plant cells work pretty much the same way:
!enter image description here