The fundamental principle in freeze-drying is sublimation, the shift from a solid directly into a gas. Just like evaporation, sublimation occurs when a molecule gains enough energy to break free from the molecules around it. Water will sublime from a solid (ice) to a gas (vapor) when the molecules have enough energy to break free but the conditions aren’t right for a liquid to form.
There are two parts to freeze drying, Freezing and Drying.
When the food is placed into the freeze dryer, the machine will lower the temperature until everything is frozen solid. This simple process is the Freezing part. Once the food is frozen, the shelves heat up slightly to release the frozen water. When the frozen water is released, the vacuum turns it into a gas as opposed to a liquid, which allows the water to bypass the freezer coils and empty into water reservoir chamber. This is the Drying part.
This process can take a long time. If you try to hurry the process, the food product could begin to rehydrate as the vacuum cannot pull a lot of water vapor at once. If there is more water vapor to remove than the machine can handle, that water is released back into the food items. Slow and easy is the way to go when freeze drying.
Once the water has been completely removed, the food is placed into Mylar bags and sealed. Sealed bags can last up to 30 years.
For more on the process of Freeze Drying, check out this Wikipedia Article.