Prehistoric fossils have been found here, including elephant teeth. Roman objects such as coins, vases, skeletons and evidence of buildings have also been unearthed. This demonstrates that Ervillers was inhabited in Roman times, especially at the place called "Capieau".
The parish was first recorded in the 12th century.
The seigneurie of Ervillers has passed down through the families of Viéville, Lalaing, Egmont, Luxembourg, and Diesbach-Belleroche. On 28 August 1654 Ervillers saw a visit from Louis XIV and the Queen mother, who lunched there while travelling on to Péronne[disambiguation needed] and Arras, where the siege had been lifted by Marshal Turenne.
Ervillers also has several underground shelters. They were probably old quarries and were turned into "muches." One of these underground caves was about 20 meters underground and had 9 rooms, a corridor, a stable and animal pens. Wells provided both ventilation and a water supply.
In December 1870 the Prussians pillaged the village. Ervillers was also the theatre of operations during the Battle of Bapaume (1871) in the Franco-Prussian War of 1870-71.
The First World War saw the village suffer total destruction.