pour bleach on the soil wait about 15 min they will come to the top EDIT: WHY would you want to get rid of them - they aerate the soil by creating tiny tunnels as the move. Also - they eat decaying...
Earthworms eat the soil, and excrete what they don't digest - leaving tiny piles of 'worm-poop' in the soil. This breaks down and adds to the general composition of the soil.