Valves help control the flow of fluids within a ship, ensuring proper functioning of various systems. They play a critical role in preventing leaks, maintaining pressure, and managing potential hazards, thus contributing to the overall safety of the vessel.