Fontaine joined the United States Navy and served in the Mexican–American War of 1846–1848, including the Siege of Veracruz.