Commensal bacteria are present in places that are exposed to the external environment (gastrointestinal, respiratory tract, vagina,mouth, skin). There bacteria live constantly with their hosts and only under specific conditions they are able to express pathogenic traits.
The immune system has mechanisms for tolerating these commensal micro-organisms but actively reacts with potentially pathogenic bacteria, inducing the accumulation of regulatory T (Treg) cells.
This is why there is a symbiotic relationship between the host and the microflora