When iron is exposed to water or air over a period of time, the iron reacts with oxygen in the presence of moisture to form a reddish-brown chemical compound, iron oxide. This is referred to as rust. So chemically, rust is hydrated iron(III) oxide or Fe2O3.nH2O. The chemical equation for the same is given by:
4Fe(OH)2 + O2 + xH2O → 2Fe2O3.(x+4)H2O
Iron reacts very readily with oxygen. This is one of the reasons as to why it is rare to find pure iron in nature.