The first railway line that actually went forward, between Alexandria and a port on the Nile, began moving traffic in 1854; in 1856 it extended to Cairo, and in 1858 to Suez. The idea of railways had been on Egyptian radar since the 1830s, but nothing had come of the plan until Khedive Abbas's appointment of an English engineer (Robert Stephenson) to a post in 1851. The points leading up to that in terms of Egyptian politics aren't clear to me, and the only citation I see that directly talks about it is Helen Rivlin's 1961 (!) Middle East Journal article "The Railway Question in the Ottoman-Egyptian Crisis of 1850-1852," MEJ 15, no 4 (1961): 365-88; sorry, paywall. Basically, the railway was a prestige and commercial project which did not require the approval of the Ottoman bureaucracy and others under Muhammad Ali Pasha's treaty of 1841 (which had curtailed his ambitions in return for hereditary power over Egypt), so Abbas locked on to it as a hopeful modernizer. She may be ascribing a bit too much to his success in getting Stephenson, the railway, and all the political wrangling that went with it to go his way (by saying that it was the crucial piece in making real the permanent autonomy of Egypt as a province) but there was more going on than just seeking to put rails between Alexandria and Suez. Her major failing, of course, is in having entirely British sources; Ottoman and Egyptian ones might severely upset her narrative, but we don't know. The line itself formed part of a larger network even when the Suez Canal put a section of the original railway out of business. (I've been looking for a cost, but have not found one yet.)
It can't have been cheap, though, because Abbas got the best. By the time of appointment in 1851, Stephenson--in the steps of his father, George, a rail pioneer--had a long track record (pun intended) of advising state governments on rail construction as well as a long history of his own inventions and technical developments in Britain and parts of Europe. Jeafferson and Pole's two-volume life of Stephenson is a long, somewhat dreary read, and pretty classically hagiographical as it came out in 1864, but it is at least available; volume one is here. Volume 2 is here. Michael Bailey's "Wider Horizons" chapter in his edited Robert Stephenson: The Eminent Engineer (Burlington: Ashgate, 2003) includes some drawings and images.
(The other candidates: A line from Algiers to Blida in Algeria opened in 1862. South Africa's first line opened from Durban to its harbor point, about 2 miles' length, in 1860. A 25-mile line opened from Cape Town to Eersterivier in 1862. I'd be interested to know of other cases, but Senegal is much later--1885--and I'm not aware of any other significant efforts to build transport lines.)