Allan was born in Birmingham, England, on February 26, 1842, the son of John Allan and Ann Allan. He attended parochial schools and received training as a typesetter in Birmingham. In 1863 he immigrated to the United States, and on June 17, just six weeks after his arrival, enlisted as a private in George Armstrong Custer’s 7th Michigan Cavalry. He was wounded at Shepherdstown on August 24, 1864, and discharged from the army in Washington, D.C., in the summer of 1865.
Allan bought a small farm in Prince Edward County, where he studied law by himself. In December 1867 he was admitted to the bar and afterward moved to Farmville. He unsuccessfully applied for a position with the Bureau of Refugees, Freedmen, and Abandoned Lands and soon became active in the local Republican Party and as a statewide leader of the Union League of Virginia. On October 22, 1867, Allan and James W. D. Bland were elected to represent Appomattox and Prince Edward counties in the constitutional convention that met in Richmond from December 3, 1867, to April 17, 1868. Of the 2,306 votes Allan received, only one was cast by a white man, the rest by African Americans, many of whom had recently been slaves. Allan served on the Committee on County and Corporation Courts and County Organizations and chaired the Committee on Printing and was prominent at the convention despite his youth, the brevity of his residence in Virginia, and his inexperience in politics. He criticized the constitution that the convention produced because he feared that it would not sufficiently protect the rights of the former slaves and would prolong hard feelings by virtue of its clauses imposing political restrictions on former Confederates. Out of party loyalty, he nevertheless supported the constitution at the referendum that ratified it in 1869.
Allan attended the 1868 Republican Party national convention and the following year backed the conservative Republican, Gilbert Carlton Walker, in the campaign for governor. Although called a carpetbagger and nicknamed “Yankee” Allan because of his Union army service, he became a popular and effective campaigner and was one of the best-known Republicans in Virginia for the next three and a half decades. From 1871 to 1883 he was commonwealth’s attorney of Prince Edward County, and he also served as clerk of the Farmville Town Council. From 1874 to 1877 he represented the district of Amelia, Cumberland, and Prince Edward counties in the Senate of Virginia, and he allied himself with the Readjusters during the long and bitter political conflict over the payment of the state’s debt. He also attended the 1876 Republican national convention.
In 1883 Allan moved to Richmond, where he enlarged his increasingly lucrative law practice and continued his political career. He seldom missed a Republican state convention or failed to make a speaking tour during campaign season and perennially sat on the city, county, and district Republican executive committees. He was also active in the Grand Army of the Republic (GAR). He served as commander of the Philip Kearney Post in Richmond in 1885–1886, was junior vice-commander of the national GAR in 1886, and was commander-in-chief of the GAR Constitutional Centennial in 1887. Thereafter he was more often referred to as General Allan than as Yankee Allan.
Allan married Mary Edna Land, a native Kentuckian, in Prince Edward County on February 6, 1867. They had three daughters and a son, Edgar Allan Jr., who eventually joined his father in the Richmond law firm of Allan and Allan. In 1892 Allan added to his stature among the state’s African American population by serving as one of the attorneys for Bettie Thomas Lewis, a young Richmond woman. She was the daughter of William A. Thomas, a wealthy and reclusive white man, and one of his former slaves. Thomas had frequently declared his intention to leave the bulk of his fortune of about $220,000 to Lewis, but he never executed a valid will. Lewis’s attorneys persuaded the Virginia Supreme Court of Appeals to honor Thomas’s often-stated intention, making Bettie Lewis one of the wealthiest women in Richmond.
In 1900 Allan ran for the House of Representatives from the Third Congressional District but lost to the incumbent Democrat, John Lamb. In 1901 President William McKinley appointed Allan United States attorney for the Eastern District of Virginia, but the following year President Theodore Roosevelt, siding with a segment of the Virginia Republican Party that opposed Allan’s faction, failed to reappoint him. Suffering from Bright’s disease and a chronic back condition resulting from his Civil War wound, and bitter with disappointment at this withdrawal of recognition to which he believed his long service to the Republican Party entitled him, Allan wrote a short suicide note, purchased a pistol and one cartridge, and shot himself to death in Richmond on October 28, 1904. He was buried in Glenwood Cemetery, Washington, D.C.