[1] He began his military service in 1832 as a private in an infantry company during the Black Hawk War, serving as a trumpeter under his father's command.
[5] The following year, Williams received an appointment to attend the United States Military Academy, then graduated in the Class of 1837 and he also taught mathematics at West Point in 1844.
On September 28, 1861, President Abraham Lincoln promoted Williams to Brigadier General of U. S. Volunteers, to rank from that date and on February 3, 1862, the U.S. Senate confirmed his nomination.
The purpose of the canal was to develop a channel for navigation that would enable gunboats and transports to bypass the Confederate batteries at Vicksburg.
In August 1862, Confederate forces under the command of General John C. Breckinridge attacked the Union defenses of Baton Rouge in an effort to retake the state's capital.
In the resulting engagement, the Battle of Baton Rouge, Williams was killed by a gunshot wound to his chest on August 5, 1862, while leading what proved to be the successful defense of the city.
[13] Williams's body was aboard the transport steamer Whiteman or Lewis Whitman (sources differ) along with other dead and wounded from the Battle of Baton Rouge when the steamer sank in the Mississippi River near Donaldsonville, Louisiana, with the loss of all hands after colliding with the United States Navy sloop-of-war USS Oneida on August 7, 1862.