The settlement of the Afan valley resulted from the development of the mining industry from the late 1850s. Railways were built into the valley to work these coal deposits and provide links with metal industries of the lower valley and coastal ports.
The Rhondda Swansea Bay Railway station at Cymmer c. 1910.
Large numbers of workers arrived to work in the mines and settlements were built along the valley to house miners, railway workers and their families. Although the valley is narrow and deep the valley had three main railway lines.
- The first railway to enter the valley was the South Wales Mineral Railway. Built between 1856-65, it linked Glyncorrwg, Cymmer and the Gyfylchi tunnel with Briton Ferry docks. The line produced an outlet for collieries to the area and in the 1920s carried passenger traffic.
- Next to enter the valley was the Llynfi and Ogmore railway which in 1878 linked with Cymmer via a tunnel from the Llynfi valley near Caerau and later up the valley to Abergwynfi. The line linked the valley with Bridgend and Cardiff.
- The third railway to arrive in the valley was the Rhondda and Swansea Bay Railway which between 1885-90 linked Port Talbot via Cymmer, the Croeserw viaduct and Gelli tunnel to Blaengwynfi and by a tunnel some two miles long to the Rhondda Valley.
The Port Talbot Railway and Dock Company were the last to build a railway in the valley. It linked the Pelenna Valley and Tonmawr via the viaduct at Pontrhydyfen to Port Talbot docks. The company shared the tracks of the South Wales Mineral Railway and the line opened for traffic between Port Talbot and Glyncorrwg in 1898.
A major task on the Rhondda Swansea Bay Railway was the cutting at Pontrhydyfen known locally as the "Rock of Gibraltar".
The railways allowed the movement of coal, pit props and other goods providing links with the Rhondda and Llynfi valleys, ports and towns.
Regular passenger services allowed the people of the valley to visit Aberafan on market day and special trains were laid on for visits to Neath Fair and the Barnum and Bailey circus at Swansea or the seaside at Porthcawl.