Born in Baden-Baden, in the German state of Baden, Weber served as an infantry lieutenant in the Grand Duke's army before the Revolutions of 1848 caused him to emigrate to America, one of a large group of political refugees who came to be as known as the Forty-Eighters. He settled in New York City and worked in a hotel that became an important gathering point for fellow German immigrants.
Weber volunteered to fight in the Civil War in May 1861, raising a German-American unit known as the "Turner Rifles," a company that eventually became a part of the 20th New York Infantry. Promoted to brigadier general, Weber commanded the Union garrison at Fort Monroe in Virginia. He commanded various other units with neither outstanding distinction nor unusual failure, eventually rising to command the Third Brigade, Second Division, Second Army Corps in the Army of the Potomac.
He served with his brigade during the Peninsula Campaign in Virginia. His arm was grievously wounded at the Battle of Antietam in an ill-fated attack on Confederate positions in the Sunken Road. The injury forced Weber off to a series of desk assignments for the duration of the conflict. He served on administrative and recruiting duty in Washington, D.C., in 1863. The following year, he was the garrison commander of Harpers Ferry and those Federal troops between Sleepy Creek and the Monocacy River. He briefly returned to the field and fought against Jubal A. Early's 1864 raid on Washington, and then returned to administrative duty.
After the war, Weber served as U.S. counsel in Nantes, France, and in several tax-collecting capacities.