The Prime Minister was speaking during a visit to the Rwandan capital of Kigali, while at home commuters and travellers have faced disruption due the second second strike of the week by railway workers.
Around 40,000 members of the Rail, Maritime and Transport (RMT) union at Network Rail and 13 train operators walked out again on Thursday after talks failed to resolve a bitter row over pay, jobs and conditions.
Just one in five trains are running, and they are mostly restricted to main lines, with around half of the network closed.
“I just think it is important to remember that these strikes are unnecessary. I think people should get around the table and sort it out,” Mr Johnson said.
The Prime Minister promised that he wanted a “great future” for British railways, stressing his own experience as Mayor of London between 2008 and 2016.
“This is a Government that is investing more in railways than any previous Government in the last 50 years,” he said.
Mr Johnson referenced HS2, as well as the recently-opened Crossrail project in London.
He continued: “To have a great future for rail, for railway workers and their families, we have got to have some sensible reforms and that is things like reforming ticket offices – I did a huge amount of that when I was running London.
“It is stuff that maybe the union barons are more attached to, perhaps, than their workers.”
“I want us to work together with railway staff for a better future for the railway.
“I think the strikes are a terrible idea,” he said.