The shadow chancellor, who played a prominent role in Labour’s election campaign, said "I’ve done my bit", and suggested a big reshuffle of Labour’s front bench team will now take place.
Mr McDonnell added that while "Jeremy was the right leader", it is time for the party to "move on" under new leadership.
Mr McDonnell added: "We will all go now. The new leader will come in place and appoint a shadow cabinet. I won’t be part of the shadow cabinet.
"I’ve done my bit. We need to move on at that stage with that new leader," he told reporters
A senior source close to Mr McDonnell, who has been shadow chancellor since 2015, said: "John will stay in place until a new leader and new frontbench team is in place."
It comes as Mr Corbyn has indicated he will quit as Labour leader in the early part of next year, despite facing calls to quit immediately after his party’s poor election showing.
The election saw Labour swept aside by the Conservatives in its heartlands in the Midlands, north Wales and north-eastern England, with Jeremy Corbyn’s party securing the fewest number of seats since 1935.
Some traditional Labour constituencies, such as Darlington in the north of England, now have a Conservative MP for the first time in decades - in the case of Bishop Auckland, for the first time since the seat was created.
Mr McDonnell, who retained the Hayes and Harlington seat he has held since 1997 in Thursday’s election, added that Mr Corbyn had been "demonised by a smear campaign against him" by the media.
"No. I didn’t back the wrong person because Jeremy was the right leader. We could have won in 2017. Things moved on. Brexit dominated everything," he said.
Asked if Mr Corbyn was the reason for the party’s defeat, he added: "I think there is an issue to be discussed about how the use of the social media – but also the overall media - has turned someone who I think is one of the most principled, honest, sincere, committed anti-racist politicians demonised by a smear campaign against him."
Responding to a disastrous night for Labour, Mr Corbyn said he would not be leading the party into another general election.
Speaking about the timetable for him to leave, Mr Corbyn said: "The National Executive will have to meet, of course, in the very near future and it is up to them. It will be in the early part of next year."
Positioning in the race to become the next Labour leader has already started, with ardent Remainer David Lammy confirming he was considering putting his name forward.
- ITV News Digital Producer Natalia Jorquera asks: "Will a woman be the next Labour Party leader?"
Others being touted to take over include Lisa Nandy, who represents Leave-voting Wigan, Rebecca Long-Bailey, Angela Rayner, Sir Keir Starmer, Jess Phillips and Emily Thornberry.
Mr McDonnell named Labour’s shadow business secretary Rebecca Long-Bailey, shadow education secretary Angela Rayner, and shadow justice secretary Richard Burgon, as part of a "new generation" who could be expected to take leading positions.
He also added that Brexit was not the only reason for Labour’s significant defeat.
"I think we will be in a position, learning lessons listening to people, constructing a broad coalition right across the country. In those seats we have lost, it is about listening to people.
"I think it wasn’t just Brexit. I think a long history of maybe 40 years of neglect and them saying to politicians 'you never listen to us and you have allowed our community to run down in this way'.
"I am hoping that will enable us to construct a programme to address those issues, but it has got to be from the grassroots and community upwards," he said.