The small settlement which became Magruder was named for American Civil War Confederate General John B. "Prince John" Magruder. During the Peninsula Campaign of the American Civil War in 1862, a large federal force under General George B. McClellan began at Fort Monroe at the entrance to Hampton Roads and moved west to attempt to capture the Confederate capital city of Richmond.
General Magruder headed a small force known as the Army of the Peninsula. His mission was to delay the federal advance, and he became well known for his deceptive and successful tactics in doing so. The carefully orchestrated demonstrations of illusion of the "Prince John Players" fooled Union leaders into thinking his troops behind the Warwick Line were far greater in number than they really were. The ruse delayed McClellan's movements, causing the cautious leader to plan and deploy an elaborate siege of Yorktown, which was abandoned by the Confederates retreating towards Williamsburg and Richmond only a short time before McClellan intended to launch his siege. The federal pursuit was delayed partially because of ruse, and the only substantial combat between the forces was against a Confederate rear guard just east of Williamsburg, where the earthen Fort Magruder stood at the junction of the only two roads leading from the east. The Battle of Williamsburg resulted, the only major skirmish between the large armies before the Confederates reached the outer defenses of Richmond. There, Magruder's delaying tactics had helped provide Confederate leaders important time needed to build a system of defensive works outside Richmond. The federal campaign culminated in failure after the series of battles known as the Seven Days Battles just east of Richmond.
After the Civil War and Emancipation, the area in which Magruder was located became settled by African American families, mostly composed of former slaves (freedmen). Nearby, the Chesapeake and Ohio Railway (C&O) built through the area in 1881 to reach the coal piers and the new city of Newport News on the ice-free harbor of Hampton Roads. The C&O later built a spur line which extended to Magruder Station.
During World War II, in 1942-43, the U.S. Navy took over a large area in the north western portion of York County to train Seabees and hold special German prisoners-of-war which became known as Camp Peary. All residents of the entire towns of Magruder and Bigler's Mill were removed. Many of the black residents of Magruder and at least one church were relocated to the community of Grove in nearby James City County. Grove had been sparsely populated until another large influx of displaced families had moved there during World War I, when their land was taken to create a military reservation which became the Naval Weapons Station Yorktown.
After World War II, the area was turned over by the Navy to the Commonwealth of Virginia and was used as a state game preserve. Then, in 1951, the Navy reclaimed the land and closed the base to the public. Despite efforts at secrecy, Camp Peary eventually became well-known as "The Farm," a training facility for the U.S. Central Intelligence Agency (CIA). Although the roads and structures are still there and occupied, access to the base is still restricted.