Military use of railways is based on its ability to move troops and materials rapidly and, less usually, on its use as a platform for military systems, like armoured trains.
Armoured trains usually had a number of railroad cars, equipped with machine guns and heavy artillery, and were heavily protected with armour. The armies of several countries used these military trains during the late 19th and 20th century till World War II. Armoured trains were protected by a variety of thick metal plates, but concrete and even sandbags were sometimes used to create makeshift armoured trains in some conflicts.
Here below the Italian military trains of the First World War.
and the Italian military trains of the Second World War.