The railway line is consisting of various sections opened along Prussia and former lands of Congress Poland, which itself was part of Russian Empire. The first section was opened by Niederschliesische Zweigbahn company on 1 October 1846, running between Glogau (Głogów) and Sagan (Żagań) stations. Later, on 30 December 1857, the Breslau-Posen-Glogauer Eisenbahn company opened the stretch from Lissa (Leszno) to Klein Gräditz (Grodziec Mały), and on 18 May 1858 opened the subsequent section to Glogau station, along with a bridge over the river Oder. Next section was opened by Niederschlesisch-Märkische Eisenbahn company on 31 December 1871, from Sagan to Sorau (Żary) station, which received another link half-a-year later, on 30 June 1872, to Forst, which already had a functioning railway connection to Cottbus. In 1888, all railways in Prussia were nationalised, and new section from Lissa to Ostrowo (Ostrów Wielkopolski) was opened on 1 October. Latest Prussian section of the railway line was opened on 14 February 1896, from Ostrowo to Neu Skalmierschütz (Nowe Skalmierzyce), near the Russian-Prussian border.