During the first years of the Napoleonic Wars, the French government offered a hefty cash award of 12,000 francs to any inventor who could devise a cheap and effective method of preserving large amounts of food. Nicolas Appert was awarded the prize in 1810 by Count Montelivert, a French minister of the interior. To get the money, there was a condition that Appert make his method public. So, the same year, Appert published L'Art de conserver les substances animales et végétales (The Art of Preserving Animal and Vegetable Substances). This was the first cookbook of its kind on modern food preservation methods.

The reason for lack of spoilage was still unknown at the time; it would be another 50 years before Louis Pasteur demonstrated the role of microbes in food spoilage.

In France, using Appert's methods, the French Army began experimenting with issuing canned foods to its soldiers, but the slow process of canning foods and the even slower development and transport stages prevented the army from shipping large amounts across the French Empire. Finally, the war ended before the process was perfected. For Appert, the factory which he had built with his prize money was razed in 1814 by hostile soldiers invading France.

Following the end of the Napoleonic Wars, the canning process was gradually employed in other European countries and in the US.

More Info: en.wikipedia.org