Following the Bronze Age, no permanent settlements existed around Hatvan until the 1170s, however archeological evidence suggests Scythians, Celts, Roxolani, Sarmatians, Avars, and eventually Magyars passed through the region.
Louis I of Hungary passed though the settlement multiple times leading his forces on campaigns into Lithuania, and eventually Hatvan was officially granted the status of market town.
After the occupying Ottoman pasha of Buda Mehmed Yahya Pashazade pushed his armies north and captured Visegrád and Nógrád in 1544, the captains of Hatvan's freshly constructed castle made the decision to burn their fortifications down, lest they fall under Turkish control.
The Ottomans made Hatvan the head of their newly conquered sanjak, causing such a large influx of Turkish soldiers and officials that by the 17th century the local Hungarians became a minority in the city.
The Turks reenforced the city with an extensive system of fortifying pile walls, which they made fireproof by caking them with clay.
Following the defeat of the Ottomans, Hatvan was reintegrated into Hungarian society: In 1689 the town gained postal service, in 1693 a customs office was built, and by 1700 the local parish resumed operation.