Railways as a mass rail transport in Ukraine were first built under the imperial rule of the Austro-Hungarian Empire (in the western territories, Kingdom of Galicia and Lodomeria, Duchy of Bukovina and the Hungarian comitatus in Carpathian region "Karpatalja"), and later in the Russian Empire-controlled territories that held bigger portion of modern Ukraine, having seen major development and reformation since.

On territory of modern Ukraine, railroads that were used by self-propelled locomotives (in contrast to horse-drawn) appeared in 1860s on efforts of Prince Leon Sapieha.
Particularly it started with the extension of the Galician Railway of Archduke Charles Louis from Przemyśl (Premissel) to Lviv (Lemberg).
The first train arrived to Lemberg using the railroad on 4 November 1861.

Also during the Crimean War in 1855 British troops built a 23 km (14 mi) long railroad on territory occupied by the Allied military forces between Sevastopol and Balaklava to improve their military logistics in their fight against the Russian Empire.
After the war, in 1856 the Russian authorities disassembled the road.

Later in 1860s the railroad from Lviv extended further towards Chernivtsi (at that time Czernowitz was a capital of a crown land Duchy of Bukovina) and Iași (at that time Jassy was in the Kingdom of Romania).
Also in 1865 in the Russian Ukraine railroad started to be built from Odessa towards Balta.

In 1869-70 in Russian Ukrainian gubernias started a mass construction of railroad network from Kursk one west towards Kiev and another south towards Lozova (between Kharkiv and Dnipro) passing Kharkiv.
Between Darnytsia and Kiev was built Struve Railroad Bridge.
From Lozova railroad expanded east towards Donbas area through Sloviansk and reaching Horlivka.
At about the same time the Odessa railroad from Balta through Kremenchuk–Kriukiv expanded towards Poltava providing another railroad connection of both Dnieper banks.
In Kriukiv (now in Kremenchuk) was built the Kryukiv Railway Car Building Works.
In 1869 from Rostov-on-Don railroad through Taganrog was extended to Horlivka.
Also in Austria, the railroad extended from Lviv towards the Austria-Russia border near Brody and in 1870 extended to Ternopil (Tarnopol).
In 1870 Kiev through Vinnytsia and Zhmerynka was connected with the Odessa–Balta railroad.

In 1871 there was built the first Austria-Russia border rail crossing when Ternopil was connected with Zhmerynka over Zbruch River near Volochysk and Pidvolochysk located on opposite banks of the river.
In 1871 Poltava was connected with Kharkiv providing with an alternative to reach the city of Odessa and its port with the Russian central provinces through Kharkiv.
In 1872-73 major expansion of railway network started in Russian Volhynia branching out of the Kiev-Odessa railroad near Koziatyn west pass Brest-Litovsk and connecting such cities like Kovel, Rivne, Zdolbuniv, Shepetivka, Berdychiv and others.
In 1873 from Zdolbuniv was extended another branch towards Brody becoming another border rail crossing.
Some railway network expansion took place in Donbas area as well.
In 1873 from Znamianka in Central Ukraine located on the Poltava-Balta road another branch was stretched south towards the port of Mykolaiv at Black Sea making it the second seaport in Ukraine connected to network of railways.
About that time a system of railroads expanded further towards the Drohobych-Boryslav oil fields and bigger Sambor areas in Ukrainian Carpathians and another rail branch was extended along Tisza River in Hungary.

In 1873-75 from Lozova railroad expanded towards Crimean peninsula connecting Sevastopol with Kharkiv through Chonhar peninsula.

For more information, see:
Imperial Royal Austrian State Railways
Hungarian State Railways (For Zakarpattia region)
History of rail transport in Russia
History of rail transport in Poland
Rail transport in the Soviet Union
Railways as a mass rail transport in Ukraine were first built under the imperial rule of the Austro-Hungarian Empire (in the western territories, Kingdom of Galicia and Lodomeria, Duchy of Bukovina and the Hungarian comitatus in Carpathian region "Karpatalja"), and later in the Russian Empire-controlled territories that held bigger portion of modern Ukraine, having seen major development and reformation since. 
On territory of modern Ukraine, railroads that were used by self-propelled locomotives (in contrast to horse-drawn) appeared in 1860s on efforts of Prince Leon Sapieha. Particularly it started with the extension of the Galician Railway of Archduke Charles Louis from Przemyśl (Premissel) to Lviv (Lemberg). The first train arrived to Lemberg using the railroad on 4 November 1861.
Also during the Crimean War in 1855 British troops built a 23 km (14 mi) long railroad on territory occupied by the Allied military forces between Sevastopol and Balaklava to improve their military logistics in their fight against the Russian Empire. After the war, in 1856 the Russian authorities disassembled the road.
Later in 1860s the railroad from Lviv extended further towards Chernivtsi (at that time Czernowitz was a capital of a crown land Duchy of Bukovina) and Iași (at that time Jassy was in the Kingdom of Romania). Also in 1865 in the Russian Ukraine railroad started to be built from Odessa towards Balta.
In 1869-70 in Russian Ukrainian gubernias started a mass construction of railroad network from Kursk one west towards Kiev and another south towards Lozova (between Kharkiv and Dnipro) passing Kharkiv. Between Darnytsia and Kiev was built Struve Railroad Bridge. From Lozova railroad expanded east towards Donbas area through Sloviansk and reaching Horlivka. At about the same time the Odessa railroad from Balta through Kremenchuk–Kriukiv expanded towards Poltava providing another railroad connection of both Dnieper banks. In Kriukiv (now in Kremenchuk) was built the Kryukiv Railway Car Building Works. In 1869 from Rostov-on-Don railroad through Taganrog was extended to Horlivka. Also in Austria, the railroad extended from Lviv towards the Austria-Russia border near Brody and in 1870 extended to Ternopil (Tarnopol). In 1870 Kiev through Vinnytsia and Zhmerynka was connected with the Odessa–Balta railroad.
In 1871 there was built the first Austria-Russia border rail crossing when Ternopil was connected with Zhmerynka over Zbruch River near Volochysk and Pidvolochysk located on opposite banks of the river. In 1871 Poltava was connected with Kharkiv providing with an alternative to reach the city of Odessa and its port with the Russian central provinces through Kharkiv. In 1872-73 major expansion of railway network started in Russian Volhynia branching out of the Kiev-Odessa railroad near Koziatyn west pass Brest-Litovsk and connecting such cities like Kovel, Rivne, Zdolbuniv, Shepetivka, Berdychiv and others. In 1873 from Zdolbuniv was extended another branch towards Brody becoming another border rail crossing. Some railway network expansion took place in Donbas area as well. In 1873 from Znamianka in Central Ukraine located on the Poltava-Balta road another branch was stretched south towards the port of Mykolaiv at Black Sea making it the second seaport in Ukraine connected to network of railways. About that time a system of railroads expanded further towards the Drohobych-Boryslav oil fields and bigger Sambor areas in Ukrainian Carpathians and another rail branch was extended along Tisza River in Hungary.
In 1873-75 from Lozova railroad expanded towards Crimean peninsula connecting Sevastopol with Kharkiv through Chonhar peninsula.
For more information, see:
Imperial Royal Austrian State Railways
Hungarian State Railways (For Zakarpattia region)
History of rail transport in Russia
History of rail transport in Poland
Rail transport in the Soviet Union
Rail transport in Ukraine