Duncan was born and raised in rural Chanceford Township in southeastern York County, Pennsylvania, which borders the broad Susquehanna River. He was appointed to the United States Military Academy on July 1, 1845, and graduated from West Point in June 1849. A good student, he ranked 5th in a class of 43 cadets. With his high academic standing, he was breveted as a second lieutenant and assigned to the Second U.S. Artillery in July of that year. Not long afterwards, on October 31, he was given the full rank of second lieutenant and reassigned to the Third Artillery. He saw his first combat action serving in the Florida hostilities against the Seminole Indians.