Merriam was born in Houlton, Maine, to Lewis and Mary (Foss) Merriam. He attended Colby College in Waterville but left school in 1862 to join the 20th Maine Volunteer Infantry Regiment as a captain. He participated in the Battle of Antietam on September 17 and received a brevet promotion to lieutenant colonel for his actions there. In 1863, he went to Louisiana to help recruit African American troops and was placed in command of the 1st Louisiana Native Guard. He led this regiment at the Siege of Port Hudson on May 27, 1863. Two years later, after the unit had been re-organized as the 73rd Infantry Regiment, United States Colored Troops, he led an attack on Confederate positions at Fort Blakely in Baldwin County, Alabama, on April 9, 1865. For these actions, he was brevetted colonel and, several decades later on June 28, 1894, awarded the Medal of Honor. His official Medal of Honor citation reads: "Volunteered to attack the enemy's works in advance of orders and, upon permission being given, made a most gallant assault."