The pair joined several hundred people outside King’s Cross St Pancras Station on Saturday afternoon for the Rail, Maritime and Transport Union (RMT) rally.
It comes as members walk out for the third time this week amid a bitter pay, jobs and conditions dispute with little sign of a breakthrough in discussions between the union and rail operators.
The Labour leader has come under pressure from unions to stand up for workers’ rights and support the industrial action.
Sir Keir reportedly ordered his frontbench MPs not to join picket lines, but several were pictured with strikers outside stations earlier in the week.
Speaking to the PA news agency at the rally on Saturday, Mr McDonnell, the former shadow chancellor under Jeremy Corbyn, said: “I’m on picket line after picket line and so are many Labour MPs.
“I’m saying to Keir Starmer and other Labour MPs as well, do the right thing.
“If you think RMT have got a justifiable dispute, we should support them. I think it is justifiable.
“Follow your conscious so therefore for me that means Labour MPs being on picket lines and it includes Keir Starmer as well coming off the fence, supporting working people because they’re not asking for the world.
“They’re asking for protection.”
During her speech to the crowds, Ms Abbott also criticised the party leadership, saying she does not “understand” the argument for Labour not joining the picket lines.
The former shadow home secretary said: “I’m proud to be speaking here, proud to be speaking on RMT picking lines and I have to say I don’t understand this argument that Labour MPs should not be on picket lines.”
She said: “I don’t understand the argument that Labour should not be there because we are not supposed to pick a side.
“I thought when you join the Labour Party you had picked a side – on the side of working people.
“And this is a strike that is important for all working people and people on low incomes right across the country.
“We’ve had austerity for 12 years and now this is the first fightback against austerity.”
Instead of giving his unequivocal support to the workers, Sir Keir has sought to blame the Government for the walk-outs, saying he did not want the strikes to go ahead.
But deputy leader Angela Rayner gave her clear backing to the industrial action, tweeting: “Workers have been left with no choice.
“No one takes strike action lightly. I will always defend their absolute right to do so for fairness at work.”
Sir Keir is reportedly considering possible disciplinary action over those who joined picket lines against his orders.
One of his advisers Simon Fletcher, who also advised former leaders Jeremy Corbyn and Ed Miliband, warned there will be an “explosion” if the party disciplines any frontbenchers.
Mr Fletcher said there has been “a lot of simmering resentment and irritation” over the party’s current position.
Meanwhile, the Conservatives have sought to use the row to claim Labour is on the side of the striking workers, who have caused chaos for millions of commuters, and the opposition leader will be reluctant to give the Government any more ammunition for that attack.