There's plenty of bacteria in stagnant water, but it's what's called anaerobic bacteria. "Anaerobic" means not using oxygen, and that's actually a misnomer. Anaerobic bacteria does need oxygen. But it has the ability to take oxygen from nitrate (NO3) and sulfate (SO4). Nitrate reduction isn't a problem, as the only by product is nitrogen gas. But sulfate reduction produces hydrogen sulfide (H2S), which smells like rotten eggs and can be toxic to fish at high enough levels.