Gapeworm is a type of roundworm that attaches itself to the host's trachea and sometimes travels to the lungs, causing difficulty in breathing, and often times death by suffocation. It is a danger to chickens who eat an earthworm, slug or snail infected with the gapeworm larvae. Often an affected hen will seem to have a respiratory problem, 'gaping' her mouth open when she breathes, coughing and making gurgling noises. Her crop may also be large and squishy.
Pullets under eight weeks old are the most susceptible, but chickens of any age can contract gapeworm. However, adding apple cider vinegar, food-grade Diatomaceous Earth and fresh minced garlic to your flock's diet can help guard against worm infestations and the natural wormer Verm-X along with VetRx which treats respiratory issues naturally can be used to treat gapeworm if your hens do contract them.
Gapeworm, while scary-sounding and potentially life-threatening if not treated, is actually not very common in backyard flocks. It is only contracted from infected worms, slugs and snails, and I don't believe that the slight risk should deter you from feeding your chickens (or allowing them access to) earthworms and other nutritious wiggling, squirming, squishy treats.