About 1775 Ziegler emigrated to Lancaster County, Pennsylvania, soon before shooting began in the American Revolutionary War. He served in the Continental Army as a lieutenant and adjutant under Colonel William Thompson in the 1st Pennsylvania Regiment, a unit with many German immigrants. He was severely wounded at the Battle of Long Island on August 27, 1776. After recovering, he rejoined General George Washington's army for the Philadelphia campaign, seeing action at Brandywine, Germantown, Paoli and Monmouth, and wintering with the army at Valley Forge.