According to Fernandez, the French navy needed a
butter-like foodstuff that would last through long voyages, and Margarine was
invented in 1869 to solve the problem.
Source: Near a
thousand tables: A history of food ( Felipe Fernandez)
According to IMACE, the International Margarine Association of the
Countries of Europe:
"Margarine was discovered in 1869 by
Hippolyte Mège Mouriès, a French food research chemist, in response to
Napoleon III's request for a wholesome butter alternative. It is not entirely
clear whether the primary aim was the betterment of the working classes or
economics in the supply of food to the French army. In a laboratory, Mège
Mouriès solidified purified fat, after which the resulting substance was
pressed in a thin cloth, that formed stearine and discharged oil. This oil
formed the basis of the butter substitute."

Hippolyte Mège Mouriès: He invented
margarine.