It can occur during production, from manure and water, during processing from environmental sources and during the final handling and packing, possibly as a result of poor human sanitation.
All agriculture damages the environment - think of all those felled forests and ploughed-up prairies, all the irrigation water, manure, tractor fuel, pesticides and fertiliser.