If you hear a loud thud as a washing machine turns on, that noise is called a water hammer. The banging or slamming noise is caused by a lack of air in the pipes, which leaves no air cushion to absorb the shock of water turning off.
The operation of a washing machine calls for water several times during its cycle so it has an electrically-operated solenoid valve. The valve opens and closes very fast and can create a shock wave in the pipe when the water abruptly stops. The loud noise is annoying, but the shock wave can do real damage by bursting a hose or rupturing a plumbing line. The addition of water hammer arresters—think of them as shock absorbers—usually solves the problem.