Exposure to different allergens or bacteria can help your immune system develop antibodies and other useful proteins that can aid in fighting infections in the future. There is also evidence to suggest that having pets in the home may help children develop antibodies slowly over time. There is certainly nothing wrong with children playing in the dirt outside, but this should always be followed by good sanitary habits including washing hands and exposed areas with soap and water. Cleaning up after play also helps prevent any significant infections from developing initially with contact.