The history of rail transport in Poland dates back to the first half of the 19th century when railways were built under Prussian, Russian, and Austrian rule.
In 1847 Mysłowice at the border of Austrian Galicia was reached and the connection to Kraków and Upper Silesian Railway complete.
This Oberschlesische Schmalspurbahn (OSSB) survived the nationalization of the standard gauge lines, and in two steps 1920 and 1945 became present day Górnośląskie Koleje Wąskotorowe (GKW).
At the same, the Prussian Eastern Railway was planned from Berlin to Königsberg (present day Kaliningrad), passing through stations like Küstrin (Kostrzyn nad Odrą), Schneidemühl (Piła), Bromberg (Bydgoszcz) with a branch to Danzig (Gdańsk).
In 1867, two other lines were opened: from Stettin/Szczecin to Danzig/Gdańsk via Stargard Szczeciński, Belgard (Białogard), Köslin (Koszalin) and Lauenburg in Pommern (Lębork); Frankfurt to Poznań via Reppen (Rzepin) and Bentschen (Zbąszyń).
The Chancellor of Germany, Otto von Bismarck, supported the elimination of speculation on railway joint-stock companies.
He also supported the state's compulsory purchase of railways from private owners, as well as the introduction of an exclusive goods rate for the transport of agricultural products from Pomerania and East Prussia to Berlin.
[1] In 1893, the Prussian state railways introduced the first modern fast trains (in German "D-Zug") using the new steam locomotive (S2/PKP class Pd1) which could reach a speed of 100 kilometres per hour (62 mph).
In 1898, the first locomotive using superheated steam in the world, designed by Wilhelm Schmidt, was produced by the Vulkan company in Stettin for Prussian state railways (KPEV Hannover 74 S4).
Three years later, production of cargo locomotive G8.1 of the Prussian state railways (PKP class Tp4) in the F. Schichau factory in Elbing commenced.
In the same year, after the outbreak of the Spring of Nations, the first large international railway-military operation dispatched over 200,000 mounted Russian soldiers from Warsaw to Vienna and Budapest to help the Emperor of Austria put down the uprising.
In 1894, the Warsaw–Vienna Railway ordered 13 fast steam locomotives with the Prussian S 2 design, and a series of modern 4-axle cars which covered transit routes from Schwartzkopff.
One year later, a decision was made to readjust the Warsaw and Vienna Railway to broad gauge track, but it was not realized.
In 1906, it was joined to Nowe Skalmierzyce on the Prussian side of the border, providing a direct communication between Łódź and Lower Silesia.
The Russian General Staff confirmed the exclusive production of wide gauge equipment in the territory of Russia.
In its retreat the Tsar's army also destroyed the central locomotive hall of Russian-Polish standard gauge railways in Łowicz and Saint Petersburg Station in Warsaw.
On 3 January 1918, the Regency Council transferred the management of the state railway in the former Congress Poland to the Ministry of Business and Industry.
Gaining independence on 11 November 1918 allowed Poland to reclaim the former Russian and Austrian sectors from military railways.
One year later, the fights for Lwów were over and the former Austrian railway directorate was taken over by Poland and their left-hand traffic infrastructure was reconstructed.
[3] After the victory over the Red Army in the Polish-Bolshevik War (1920), a great deal of damage in railway structure was discovered on the route along which the communists were retreating.
At the same time, the tense relations with Lithuania led the railways around Wilno and Minsk to a partial disintegration and stagnation.
The same year French authorities offered one hundred captured German steam locomotives and two thousand cargo vehicles.
After 1933, PKP had to deal with competition by "wild" carters and raftsmen, offering horse and river transport for distances over 150 kilometres (93 mi) at lower prices than the railway.
A Customs War with Germany started in 1925, causing a rush to build a port in Gdynia and a detour line from Silesia to the coast by-passing German territory.
Early German attacks on the Soviet Union resulted in Ostbahn possessing railway and rolling stock of PKP with broad gauge track.
Organized sabotage of railways by the Polish resistance movement in World War II began about the same time.
The unfinished Warszawa Główna railway station was partially destroyed several times 1939-1941 and finally blown up by the Germans.
Polish railways regained pre-war locomotives from Hungary, Czechoslovakia and Yugoslavia (in 1947), yet units from the eastern parts of Poland were taken over by USSR and rebuilt to operate on a wide gauge.
Reconstruction of German S-Bahn EMUs started the same year, which required building overhead lines in the Tricity area.
The highest speed reached by railway in Poland during the communist period was 160 km/h in 1987 as a regularly scheduled operation from Warsaw to Kraków.