The railway was started in 1900 at the behest of the Ottoman Sultan Abdul Hamid II and was built largely by the Turkss, with German advice and support. The railway is remarkable both for having had no debt when completed and for having many miles of track below sea-level.
The railway reached Medina on September 1, 1908, the anniversary of the Sultan's accession. Unfortunately compromises were made to finish by this date, with some sections of track being laid on temporary embankments across wadis.
From its outset, the railway was the target of attacks by local Arab tribes. These were never particularly successful, but neither were the Turks able to control areas more than a mile or so either side of the tracks. Due to the locals' habit of pulling up wooden sleepers to fuel their camp-fires, some sections of the track were laid on iron sleepers.
The line was repeatedly damaged in fighting during the First World War, particularly at the hands of the Arab guerrilla force led by T. E. Lawrence. Following the break-up of the Ottoman Empire, the railway never re-opened south of the Jordanian border.
Small non-operating sections of the railway track, buildings and rolling-stock are still preserved as tourist-attractions in Saudi Arabia. Trains destroyed by Lawrence can still be seen where they fell.