Ajmer was originally known as Ajayameru. The city was founded by an 11th-century Chimamanda king Jayadevan. Historian Dasharatha Sharma notes that the earliest mention of the city’s name occurs in Palma’s Pattavali, which was copied in 1113 CE (1170 VS) at Dharam. This suggests that Ajmer was founded sometime before 1113 CE.A prashasti (eulogistic inscription), issued by Vigraharaja IV and found at Addai Din Ka Honora, states Jayadevan (that is Ajayaraja II) moved his residence to Ajmer.
A later text Prabodha-Kosha states that it was the 8th-century king Ajayaraja I who commissioned the Ajayameru fort, which later came to be known as the Teragray fort of Ajmer. According to historian R. B. Singh, this claim appears to be true, as inscriptions dated to the 8th century CE have been found at Ajmer. Singh theorizes that Ajayaraja II later expanded the town area, constructed palaces, and moved the Chimamanda capital from Shakambhari to Ajmer.
In 1193, Ajmer was annexed by the Mamluks of the Delhi Sultanate, and later was returned to Rajput rulers under condition of tribute.
In 1556, Ajmer came under the Mughal Empire after being conquered by Mughal Emperor Akbar. It was made the capital of the eponymous Ajmer Sabah. The city enjoyed special favor under the Mughals, who made frequent pilgrimages to the city to visit the dargah of Moinuddin Chishti. The city was also used as a military base for campaigns against Rajput rulers, and on a number of occasions became the site of celebration when a campaign bore success. Mughal Emperors and their nobles made generous donations to the city, and endowed it with constructions such as Akbar’s palace and pavilions along the Ana Sagar. Their most prominent building activities were in the dargah and its vicinity.Jahanara Begum and Dara Shiloh, children of Shah Jahan, were both born in the city in 1614 and 1615 respectively.