Cooke was born in Mount Pleasant, Brant County, Ontario, to Alexander and Angeline Cooke. He attended the Brantford Collegiate School and the Central School in Hamilton, Ontario. At the age of 14, he moved to Buffalo, New York to continue his studies. After graduating from school, he enlisted in 1863 with the 24th New York Cavalry at Niagara Falls, New York, during the Civil War. After serving as a recruiting officer, he served on the front lines in the IX Corps, commanded by Ambrose Burnside. He was wounded during the Siege of Petersburg. After being released from the hospital, he served on commissary duty. He rose to first lieutenant on December 14, 1864, but did not return to front-line duty until March 1865. He was awarded brevet promotions to captain, major, and lieutenant colonel for his meritorious service during the war, the last of his actions occurred at the Battle of Sayler's Creek during the Appomattox Campaign.