OpenRailMap.com is a free website. You can use its contents as a layer in Google Maps, Open Layers and leaflet. Is it possible to download its contents as a shapefile?
The contents of OpenRailMap.com are from OpenStreetMap. It is possible to get the data comprising the tracks and related railway infrastructure as a shapefile but there are a few steps. It depends how large of an area that you need.
One approach is to download the shapefiles from GeoFabrik and then use ArcGIS or QGIS to extract out just the railways. The downloads at GeoFabrik are sorted into countries, the larger countries are subdivided into states/provinces/regions. For example Germany is divided into 16 regions. It would be a lot of work to download all the data for even a few countries.
I used this. It already has organized data based on location (continents mostly) and layer type (Rail, Road, Aerial Way, boundaries, building, emergency, highway, landuse, .. etc). It may not be trustworthy in terms of recent updates of the links/nodes and reliability but it may be used for purposes where time is critical. Just Download it and use it.
As of today, the website seems to be updated on 2016-02-01.