William McKinley's grandfather James and his father William were ironmakers. They had moved to Ohio in the early 19th century from Pennsylvania. William McKinley Jr. was born on January 29, 1843 in Niles, Ohio, the seventh of nine children. As a baby he was called "Wobbly Willie" by his family. His mother was the former Nancy Allison. The McKinleys were of English and Scots-Irish descent and had settled in western Pennsylvania in the 18th century. His grandfather had emigrated from County Antrim, in present-day Northern Ireland. The family moved to Ohio when the McKinley's father was a boy, settling in New Lisbon (now Lisbon). William Sr. met Nancy Allison there. The Allison family was of mostly English descent and the family had been some of Pennsylvania's earliest settlers. The family trade on both sides was iron-making. William McKinley Sr. operated foundries throughout Ohio, in New Lisbon, Niles, Poland, and in Canton.
The McKinley's were staunch Methodists and had abolitionist sentiments. At the time of McKinley's birth the Methodist Church was divided along northern and southern Methodism. The church had grown significantly in Ohio, due in large measure to the work of itinerant preachers. Young William McKinley had attended a series of camp meetings operated by the church, and in 1859, to the delight of his mother, he requested to be baptized as a Methodist. Nancy McKinley had hoped that her son might have aspirations for the ministry himself, but this was not to be. William Jr. followed in the Methodist tradition and remained a lifelong devoted Methodist.
In 1852, the McKinley family had moved from Niles to Poland, Ohio so that their children could attend the better schools there. William McKinley graduated from Poland Seminary in 1859, and the next year he enrolled at Allegheny College in Meadville, Pennsylvania, where he was an honorary member of the Sigma Alpha Epsilon fraternity. He remained at Allegheny for only one year, and returned home in 1860 after becoming ill. He was also reported to have shown signs of depression, first described as a "nervous condition". His health recovered, but family finances declined with the failure of his father's business, and McKinley was unable to return to Allegheny. He stayed home to help with family finances, first working as a postal clerk and later taking a job teaching at a school near Poland, Ohio.
Biographers opinions differ as to what kind of scholar McKinley was. Margaret Leech, an early biographer of his, describes her subject as having "few intellectual resources" adding that "in literature or music, he looked for obvious patriotic, sentimental or religious content". Biographers Lewis Gould and Kevin Phillips disagree with this assessment. Gould wrote that McKinley "frequently read late into the night", adding that McKinley was "far more bookish and informed than his reputation as a non-reading president would seem to indicate." McKinley as said to have enjoyed reading the Atlantic Monthly, Harper's Monthly, and Horace Greeley's New York Weekly Tribune. It has also been written of McKinley that each evening in his home, the family gathered in the sitting room where they spent an hour taking turns reading aloud.
When the Civil War began, an eighteen year old William McKinley enlisted with the Twenty-Third Ohio Infantry, a regiment with religious sentiments compatible with those of McKinley. He enlisted in June of 1861. His regiment was referred to as "the Psalm Singers of the Western Reserve" and McKinley referred to himself as a "soldier of Jesus". They were tasked with chasing Confederates in West Virginia, the part of the state that was loyal to the Union. In November of 1861 he was made quartermaster. Then in April of 1862, Private McKinley was promoted to the rank of Quartermaster Sergeant, and was tasked with the requirement of keeping the regiment provisioned and fed.
That September, McKinley’s regiment was called east to reinforce General John Pope’s Army of Virginia at the Second Battle of Bull Run. The 23rd Ohio did not arrive in time for the battle, but they joined the Army of the Potomac in its effort to cut off Robert E. Lee’s Army of Northern Virginia as it advanced north into Maryland. The 23rd was the first regiment to encounter the Confederates at the Battle of South Mountain on September 14. The Union forces suffered severe losses, but they drove back the Confederates and continued to Sharpsburg, Maryland, where they engaged Lee’s army at the Battle of Antietam.
Antietam was one of the bloodiest battles of the war. The 23rd was in the thick of the fighting at Antietam, and McKinley himself came under heavy fire when bringing rations to the men on the line. The regiment again suffered high casualties, but the Army of the Potomac caused the Confederates to retreat into Virginia. The regiment was then detached from the Army of the Potomac and returned to western Virginia. While the regiment went into winter quarters near Charleston, Virginia (present-day West Virginia), McKinley was ordered back to Ohio to recruit fresh troops.
When he arrived in Columbus, McKinley received a commission as second lieutenant in recognition of his service at Antietam. He saw little action until July 1863, when the division skirmished with John Hunt Morgan’s cavalry at the Battle of Buffington Island.
Early in 1864, the Army command structure in West Virginia was reorganized, and the division was assigned to George Crook’s Army of West Virginia. McKinley's unit marched into southwestern Virginia to destroy salt and lead mines used by the Confederates. On May 9, Crook's army engaged Confederate troops at Cloyd’s Mountain, where the men charged the enemy entrenchments and drove the rebels from the field. This battle had an especially memorable impact on McKinley, who later said the combat there was “as desperate as any witnessed during the war.” After the battle, Crooks's army continued to destroy Confederate supplies and skirmish with the enemy.
McKinley and his regiment moved to the Shenandoah Valley. Crook’s corps was attached to Major General David Hunter’s Army of the Shenandoah and soon back in contact with Confederate forces, capturing Lexington, Virginia, on June 11. They continued south toward Lynchburg, tearing up railroad track as they advanced. Hunter believed the troops at Lynchburg were too powerful, however, and the brigade returned to West Virginia. Before the army could make another attempt, Confederate General Jubal Early made his raid into Maryland, and McKinley his fellow Union troops headed north.Early’s army surprised them at Kernstown on July 24, where McKinley came under heavy fire and the Union army was defeated.
McKinley and his fellow Union troops retreated into Maryland, where the army was reorganized again: Major General Philip Sheridan who replaced Hunter. McKinley was promoted to captain after the battle, and was transferred to General Crook’s staff. By August of 1864, Early was retreating south in the valley, with Sheridan’s army in pursuit. In a Confederate assault at Berryville, McKinley had a horse shot out from under him. Sheridan's army advanced to Opequon Creek, where they broke the enemy lines and pursued them farther south. They followed up that victory with another at Fisher’s Hill on September 22, and were engaged once more at Cedar Creek on October 19. There, after initially falling back from the Confederate advance, McKinley helped to rally the troops and turn the tide of the battle.
After Cedar Creek, the army remained there through election day. McKinley cast his first presidential ballot. He voted for Abraham Lincoln. On the following day, the army moved into winter quarters near Kernstown.
The following year, in February 1865, General Crook was captured by Confederate raiders. Over the next fifteen days McKinley served under Generals John D. Stevenson, Samuel S. Carroll, and then Winfield Scott Hancock before finally being assigned to Carroll’s staff. When Robert E.Lee and his army surrendered to General Ulysses S. Grant a few days later, the war was effectively over. McKinley was transferred to Hancock’s First Veterans Corps in Washington. Just before the war’s end, McKinley received his final promotion, a brevet commission as major. Generals Carroll and Hancock encouraged McKinley to apply for a place in the peacetime army, but he declined and returned to Ohio the following month. He returned home and began to study law. His first foray into politics would come in 1867, when his army friend and mentor Rutherford B. Hayes was nominated for governor of Ohio.