Water hammer is caused by sudden changes in water pressure, leading to loud banging noises in pipes. Installing a water hammer arrestor or securing loose pipes can help alleviate the issue.