Water hammer happens when a sudden mass of water that was moving in a pipe is forced to suddenly stop resulting in that bang we've all heard that if not rectified can lead to pipes being ripped off the wall and connections bursting with the possibility of water damaging property and electrical of course.
Water hammer arrestors are used to absorb the shock when water flowing in a piping system suddenly stops due to fast closing shutoff valves, dishwashers, and clothes washers. This action protects against annoying and potentially damaging effects of water hammer.