It is perfectly fine to wash wool in a washing machine as long as extra precautions are taken. Refrain from allowing wool sweaters and other articles of clothing to go through a normal wash cycle, opting instead to regulate the process.
Avoid stretching of the garment from excessive agitation of the washing machine. When natural fibers such as wool are exposed to agitation, they become matted together in a process known as felting. Prevent this from happening by using a top-loading washing machine with controls that allow you to choose through which cycles the wool garment goes. Fill the machine with water and soap, then turn off the machine. Place the garment in the water, and allow it to soak for a few minutes, then remove it and drain the water. Place the garment back in the machine and run it through the spin cycle. Lay it flat to dry.