Plumbing: The Considered Washing Machine Hook Up
Like most plumbing systems, hookups for washing machines work extremely well if done properly, and if not, almost certainly cause problems ... sometimes big problems (like flooding and drain backups). So if you're looking into what's required before installing a new washing machine, you're on the right track. The parts and labor required for a code-compliant hookup are inexpensive and simple enough that it's worth it to update the plumbing connections as part of the job.
A washing machine receives hot and cold water from ordinary branch water lines, typically ½" rigid copper pipes. In most homes these days, the supply pipes run into an open-front plastic box set into the wall, known as a washer box. There, each water line terminates at a shut-off valve that controls the flow of water to the washer. (With some configurations, the valves are spliced into water lines that continue on to supply other fixtures, such as a utility sink).
While any appropriate valve will work, the best type is a dual valve with a single handle or lever that easily shuts off both supplies at once. It's also a good idea to include water hammer arresters (anti-shock valves) at the supply terminations, to prevent water hammer caused by the abrupt valve action of washing machines.
The flexible hoses that connect the washer to the water supply lines will have no bearing on the installation, but it's worth noting that the familiar black rubber hoses we grew up with are no longer the accepted standard. The rubber deteriorates over time, leading to leaks and house floods. The new standard is braided stainless steel -- definitely worth the negligible extra cost.
Washing machines typically come with a flexible rubber or plastic drain hose that connects to a little stubout near the bottom of the machine with a hose clamp. The hose end opposite the washer is simply inserted into the open end of a vertical standpipe -- a 2" rigid plastic pipe connected to the washer box. This setup allows the washer to vibrate or walk across the floor (like when you're washing a throw rug by itself) without damaging the pipes. The standpipe is typically 34" to 36" tall and must extend above the highest water level in the washer, to prevent siphoning. It connects at its bottom end to a P-trap, which connects to a 2" branch drain and, ultimately, the home's main stack or drain.
Space & Other Considerations
Plumbing a washer typically requires opening up one side of the wall behind the machine to expose one or two (or possibly more) stud cavities. As for room space requirements, plan for 8" of clear area between the finished wall and the back of the machine. Washer boxes typically are installed at 48" above the floor. If you have the space, you might consider setting the washer (and dryer, presumably) on top of a framed wooden base, approximately 8" tall. This makes it easier for most people to reach deep into a washer tub (for either front-loaders or top-loaders), and it protects the machine from the corrosive effects of concrete floors (as applicable).
For professional washing machine installation, hire a licensed plumber.