McFarland was born in 1828 near Mercersburg, Pennsylvania. He graduated from Marshall College and soon thereafter studied law with his cousin, Robert M. Bard, in Chambersburg, Pennsylvania. He was admitted to practice in 1849. Instead of commencing practice, however, he headed to California, arriving September 1850, and was a gold miner for three years. He then opened a law office in Nevada City where he practiced with various partners, including Addison Niles, until 1861. In September 1855, he was elected and served one term in the 1856 term of the California State Assembly from Nevada County, running on the Know Nothing or American Party ticket. On April 21, 1856, he was admitted to the bar of the California Supreme Court. In 1857, he was nominated by the Know Nothings for California Attorney General but lost the election. In 1861, he was elected judge of the Fourteenth District Court, in which capacity he served for two terms. After he retired from the bench, he practiced law in Sacramento for the next 12 years, except an interval during which he served as Register of the United States General Land Office at Sacramento, accepting this position at the suggestion of Aaron A. Sargent. In 1879, McFarland served as a member of the convention which framed the existing Constitution of California. On December 18, 1882, he was appointed to fill a two-year vacancy upon the bench of the Sacramento County Superior Court by Governor George Clement Perkins. In 1884, McFarland was nominated by the Republican Party and elected for a full term. In November 1886, McFarland was elected on the Republican ticket for a 12-year term as associate justice of the Supreme Court of California, taking his seat in January 1887. In 1898, McFarland was re-elected to the high court despite accusations he favored railroads in his rulings. He sat continuously as an associate justice up to the time of his death, September 16, 1908, a period of over 21 years. In September 1908, Governor James Gillett appointed Henry A. Melvin to finish the remainder of McFarland's term until January 1911. McFarland was originally a member of the Whig Party, but joined the Republican Party when it was organized.
McFarland married Susie Briggs at Nevada City in 1861. Briggs' sister was married to Dr. Robert M. Hunt who was the first physician to practice medicine in that town, and was a charter member of the California Medical Society. The McFarlands had one child, Jennie.