Locomotive No 563, which hauled trains on the London and South Western Railway, has been given to the Swanage Railway by the National Railway Museum.
It appeared in stage adaptations of Edith Nesbit's classic in Canada and in London.
Swanage Railway said it was "thrilled" at the acquisition.
Built in 1893, the T3 locomotive had run a total of 1.5 million miles, mainly hauling express trains between London and the south coast, by the time it was withdrawn from service in 1945.
It survived being scrapped as it was selected for restoration for a display at the centenary celebrations for London's Waterloo station in 1948.
The locomotive was transported by sea to Canada in 2011 where it spent six months at Toronto's Roundhouse Park for a theatrical production of The Railway Children.
It returned to the UK where it was used in the show at a pop-up theatre in King's Cross, London.
Swanage Railway chairman Trevor Parsons said such locomotives were "part of the story" of the development of the resort.
"We look forward to hopefully putting the locomotive on suitable display so our visitors can delight in its late Victorian engineering and see the marvellous machine that hauled trains from the city to the sea for half a century," he added.
A Victorian steam locomotive that featured in the theatre adaptation of The Railway Children has been donated to a Dorset heritage railway.