Contaminated soil
Cats may be exposed to worm eggs via contaminated soil. The eggs are very resilient and can potentially survive for years.
Infected birds, mice and fleas
Cats that hunt and eat small animals, such as birds and mice that can be infected with immature roundworms or tapeworms, can quickly become infected themselves. Moreover, cats can also become infected by swallowing an infected flea while grooming themselves.
Mother's milk
Kittens can be infected by roundworms via their mother's milk. Dormant larvae become active once the cat starts producing milk, and are transmitted to the kittens when they suckle.