Earthworms and soil just go together. They find their way on their own. They remain alive the same way they do in the soil outside. Don't put them in any plants that are xeriphytic (cacti and succulents) or that won't get regular watering, but don't drowned them either. You can usually tell that you have earthworms in a pot when you see worm castings (worm poo) coming out the drainage holes. A lot of people don't seem to like earthworms in their houseplants, but I personally think they are great soil aerators for potted plants ... probably not for small pots but I've had no problems with them in larger pots. If they die, they just turn into more fertilizer for the soil. I'm ONLY talking about earthworms here and not the little worms you often find in potted plants and definitely should eliminate asap!
This is a personal opinion only.