The federal labour board has ordered thousands of rail employees back to work after a bitter contract dispute shut down the country's two major railways.