All mammals have some strain of E.coli in them. Humans usually get E. coli as benign inhabitants of the large intestine within 40 hours of birth.They are normal gut flora in mammals, just like Salmonella is normal microflora in birds and reptiles. Issues occur when the wrong strain of E. coli gets in one's gut

The E. coli bacterium Escherichia coli is a rod-shaped bacterium that is commonly found in your lower intestine. Most E. coli strains are harmless, but some kinds can cause serious food poisoning in humans, and are occasionally responsible for product recalls due to food contamination...The harmless strains are part of the normal flora of the gut, and are very beneficial for you: They produce the important Vitamin K that you need for the synthesis of coagulation factors ...