The first railway in what was then Dahomey was opened in 1906 between the port of Cotonou and Ouidah, a distance of 47km. The gauge chosen was metre gauge, typical for a French colonial railway of the time. The main line was extended in stages to reach Parakou (437km from Cotonou) by 1936. When other lines were built, the original line became know as the Northern Line. The other lines were the Eastern Line from Cotonou to Pobé (107km) and the Western Line, a branch from the Northern Line at Pahou to Ségboroué (33km). The newer lines were closed in the latter half of the 20th century, leaving only the Northern Line open until the reopening of a short stretch of the Eastern Line from Cotonou to the capital, Porto Novo, in 1999.
In addition to the metre gauge network, several 600mm gauge railways were opened in the 1920s and 1930s, either as isolated industrial railways or as feeders to the metre gauge network. All had closed by the late 1940s or early 1950s.
In 2013, a concession was awarded for a 574km extension of the Northern Line from its terminus at Parakou to Miamey in Niger. The concession also involved rehabilitation of the remainder of the network and new passenger services. Work on the new line commenced the following year, but was halted in 2015 owing to a legal challenge and the withdrawl of the concession. The concession was re-let in 2018 and construction is believed to be progressing.