He joined the Union Army as a private in Company E of the 49th New York Volunteer Infantry in June, 1861, rising to orderly sergeant. With the Army of the Potomac his unit participated in battles which included Young's Mill, Yorktown, Williamsburg, Mechanicsville, Fair Oaks, Gaines's Mill, Savage's Station, Malvern Hill, Second Bull Run, South Mountain, Antietam, Fredericksburg, Williamsport, Gettysburg, Mine Run, Wilderness, Cold Harbor, Petersburg and others. Walsh was taken prisoner during operations against the Welden Railroad shortly prior to the expiration of his term of enlistment and was a prisoner at Belle Isle, Libby Prison, Andersonville, Savannah, Castle Pinckney and Florence Stockade, before being exchanged and returned to Annapolis, Indiana, where he was honorably discharged May 5, 1865. At some point after this, he spent eight years working at the "Wisconsin State Journal" in Madison.