In many cases, the presence of water can prevent a reaction from happening, or it can cause undesirable products to form.
Solvents are commonly rendered anhydrous by boiling them in the presence of a hygroscopic substance; metallic sodium is one of the most common metals used.