The most common method of preparing food for space is dehydration. Rehydratable foods have been dehydrated by freeze drying, air drying, or other methods. Dehydrated ice-cream does not have to be kept in the freezer and it feels like Styrofoam. The astronauts rehydrate the food by just putting it in their mouth or rehydrating it with water. Water is produced by the fuel cells which generate electricity from hydrogen and oxygen.
Water is a by-product.