It is certainly possible that your baby has a worm infection. Most worm infections are received by ingesting worm eggs, and toddlers are extremely susceptible to this. By the age of two, children can get around on their own and still tend to put random objects in their mouths, or even put their fingers and hands into their mouths. If the object or the child's hand is contaminated with worm eggs, the child becomes infected.
On the other hand, worm infections usually have other symptoms as well, such as diarrhea, irritability, and itching of the anal area. While the lack of these symptoms does not entirely rule out a worm infection, it makes it unlikely. What you noticed in your child's stool may be mucus or improperly digested food. This is relatively harmless, and happens occasionally, but if his stools continue to be this way regularly, you should visit a doctor as it may be an indication of some other problem.
In either case, whether they were worms or something else, it is best if you save a stool sample the next time this happens. The only way to be sure what they were is to get a stool test done.
answered by G M