The barracks were built during the reign of Ottoman Sultan Mustafa III between 1757 and 1774. It was later renovated and extended by Mahmud II (reigned 1808–1839) in 1828 and 1829. It is located in Rami neighborhood of Eyüp district, the then outskirts of Istanbul, the capital city of the Ottoman Empire. Historically, the site was known as the Artillery Barracks () at Rami Ranch (). The barracks were an important military facility built for the soldiers of the newly established "Nizam-ı Cedid" (literally "New Order") in frame of the Ottoman military reform efforts. It was called in . In 1836–1837, it was renamed to after the engineer students moved in to the War School situated in the barracks. It became the military headquarters of Sultan Abdulmejid I (r.1839–1861) during the Crimean War (1853–1856). The barracks took their final form during the reign of Sultan Abdul Hamid II (r. 1876–1909). During the occupation of Istanbul (1918–1923) by the Allies of World War I, the barracks served as quarter for the Algerian detachments of the French forces.