The military use of railways derives from their ability to move troops or materiel rapidly and, less usually, on their use as a platform for military systems, like very large railroad guns and armoured trains, in their own right. Railways have been employed for military purposes in wartime since the Revolutions of 1848. Improvements in other forms of transport have rendered railways less important to the military since the end of World War II and the Cold War, although they are still employed for the transport of armoured vehicles to and from exercises or the mass transport of vehicles to a theatre of operations. The US Air Force developed the Peacekeeper Rail Garrison mobile ICBM in the 1980's, but it never reached operational status. Due to the expense and time required to build specifically military railway networks, military use of railways is usually based on a pre-existing civilian railway network rather than a military-owned one. However, specialized military types of rolling stock have frequently been used. Military railway is usually built and operated by railway troops.
The Kingdom of Prussia's VI Corps, some 12,000 men and their guns, horses, ammunition and other material, was transported on two railway lines to Kraków in 1846. The Prussian Army used railways to move its forces during the First Schleswig War in 1849–1851. Three Prussian battalions were deployed by rail to crush the 1849 May Uprising in Dresden. The first Prussian regulations for transport of troops on state railways were issued in 1856.
In 1849, an Imperial Russian corps with all of its equipment, was moved by rail from Poland to Göding in Moravia to link up with the Austrian army during the Hungarian Revolution of 1848.
During the Second Italian War of Independence in 1859, the French Army moved 130,000 soldiers to northern Italy by rail. The Imperial Guard Corps from Paris and two corps from Lyon were sent to Toulon via rail, from where a total of 70,000 men were shipped to Genoa. The French I Corps was then ferried from Genoa to Novi by rail. Another two French corps were transported by rail to Savoy, where they crossed the Alps and boarded trains to Turin. To improve Piedmont's railway system, the French Navy shipped locomotives to Genoa. A French siege train was shipped from Marseille and Toulon to Genoa, from where it was moved by rail to Lombardy for use against Mantua in late June.
The American Civil War in 1861–1865 was the first large war in which railroads were both a major tool and a major target of military action. A few railroads were custom built:
In 1867 during the Paraguayan War some ironclad vessels of the Brazilian navy became trapped on the River Paraguay between the enemy Paraguayan forts of Curupaty and Humaitá. To keep them supplied with fuel, ammunition and provisions the Brazilian ministry of marine ordered an emergency military railway to be built through the almost impenetrable coastal region of the Chaco. The sleepers of this line almost floated over the boggy ground. This supply line was known as the Affonso Celso, and sustained the ironclads in their precarious position for six months, until they were able to dash past the Fortress of Humaitá in an incident known as the Passage of Humaitá.
German bombing of Polish railways contributed greatly to the swift success of the 1939 invasion of Poland. Japan built several railways for military purposes, notably the Burma-Siam Railway, known as the Death Railway because of the number of Allied prisoners-of-war and Asian labourers who died to construct it. The existing Northeast Indian Railways were expanded by the Americans to supply China via the Ledo Road. Railway lines were also constructed by the Allies in the Suez Canal area.