A trap on the drain line in your plumbing system is a specialized piece of pipe with a unique shape. Curving sharply like the letter "J", traps are integral parts of all drainpipes in your home. If you look under a sink, you'll see a trap there. For a washing machine, the trap is typically located inside the wall behind the washer. All the water that your washer uses to clean clothes flows through the trap on its way to the sewer system.
Your washing machine needs a trap on the drain line because the drainpipe connects to the sewer or septic system. This means the pipe can be a conduit for sewer gas to drift up into your home. Every time your washer drains, some of the water that flows into the pipe is caught in the trap. Gravity prevents it from going up the curve and down the rest of the drainpipe. This water in the bent portion of pipe seals the drain off, ensuring that sewer gas cannot come up through the drain and enter your home.
If you install a washing machine and don't put a trap on the drain line, sewer gas can flow into your home. Not only does it smell like sewage, making your laundry room an unpleasant place to be, but it is also a health hazard. In small concentrations, it can cause headaches. In larger amounts, it can trigger vertigo, vomiting and even unconsciousness. Some components of sewer gas, suchas methane, are flammable. If enough builds up inside your home, the gas can explode.
Even if you don't currently have a washing machine hooked up to the drain, there still needs to be a trap on the line. The water in traps can evaporate over time; it can also be siphoned out by pressure differentials in the plumbing system. This is even more likely to occur if you don't have a washing machine in active use. To avoid this, pour a few cups of water into the drain every month or so. It will fill up the trap and keep your home safe.