Children typically get infected by ingesting parasitic eggs found in contaminated soil, water, or food. The eggs hatch into larvae in the intestines, migrate through the bloodstream to the lungs, and then return to the intestines to mature into adult worms.