Roorkee was the capital of a Moghul Mahal (similar to a present day Pargana) during the time of Akbar, as is referred in Ain-e-Akbari, authored by Abul Fazal.
During the 18th century, it came under the rule of Landhaura state, till the death of its Bargujar king, Raja Ramdaval Dev in 1813  and later, became a part of the territories of the British East India Company.
Before 1840, the city was a small village of mud houses on the banks of the Solani rivulet. Digging work on the Upper Ganges Canal formally began in April 1842 under the aegis of Proby Cautley, a British officer. Soon, Roorkee developed into a town. The canal, which was formally opened in 8 April 1854, irrigated over 767,000 acres (3,100 km²) in 5,000 villages.
Another factor that contributed to the city’s growth was the inception of the ‘Roorkee College’, which has its origin in the training classes started in 1845  to train local youth to assist in the civil engineering works in the making of the Upper Ganges Canal. This was to become the first engineering college established in India. On November 25, 1847, the college was formally constituted, through a proposal by the Sir James Thomason, Lt. Governor of North Western Province (1843–53) , and after his death in 1853, the college was rechristened as ‘Thomason College of Civil Engineering’. The college later upgraded to University of Roorkee in 1949, and on September 21, 2001, through an Act of Indian parliament, it was made one of Indian Institutes of Technology, IIT Roorkee.
India’s first aqueduct was constructed over the Solani river, near Roorkee, part of the Ganges canal project, which itself was India’s first irrigation work in North India, started by the British. The Ganges Canal led to another first for Roorkee – India’s first steam engine, named “Thomason”, ran here on December 22, 1851 between Roorkee and Piran Kaliyar, two years before the first passenger train ran from Bombay to Thane in 1853. . Operated by the Bengal Sappers, the railway line was built to carry soil used for the construction of the upper Ganges canal aqueduct from Piran Kaliyar, 10 km away from the city. The locomotive rail paths are still intact. The steam engine is presently exhibited at Roorkee Railway Station.
The municipality of Roorkee was created in 1868 , when it was already home to the Bengal Sappers and Miners since 1853, and two artillery units were stationed here . Today, the Roorkee Cantonment has a large army base. The Bengal Engineering Group and Centre (BEG&C), are still here today.
Later in 1901, when the city had a population of 17,197, it was made headquarters of the Roorkee Tehsil, in Saharanpur district of the United Province of the British Raj; the tehsil included in it 426 villages (of the parganas of Jwalapur, Manglaur and Bhagwanpur) and six towns, most important among them being Haridwar and Manglaur.. The Old Cemetery in the city is today a protected monument, by Archaeological Survey of India 
Roorkee is also famous for the shrine of 13th century, Sufi saint Alauddin Sabir Kaliyari – the dargah is also known as Sarkar Sabir Pak – situated in Piran Kaliyar village, where an annual 15-day spiritual fair (Urs) is held in his honour.