This paper formulates a new switched two species chemostat model and discusses the coexistence behavior in the chemostat. A complete classification on the single-species chemostat is carried out firstly, where the stationary distribution with ergodicity is derived to exist and be unique. Then, based on the obtained stationary distribution and the comparison theorem, we put forward some sufficient conditions for the coexistence of microorganisms in the two species chemostat with Markov switchings. Moreover, when the species coexist in the deterministic chemostat for each state and have the same break-even concentrations for all states, they are proved to coexist still in the switched chemostat, which randomized the results of the classical deterministic chemostat. Results in this paper show that Markov switchings can contribute to coexistence of the two species.