In an interview with journalist Iain Dale at the Edinburgh Fringe Festival, McDonnell said any decision about holding a vote would be up to the Scottish Parliament.
He said: “It will be for the Scottish Parliament and the Scottish people to decide that.
“They will take a view about whether they want another referendum. Nicola Sturgeon said by late next year or the beginning of 2021.”
He added: “We would not block something like that. We would let the Scottish people decide. That’s democracy.
“There are other views within the party but that’s our view.”
McDonnell’s view contradicts that of Scottish Labour leader Richard Leonard.
In an interview on the BBC’s Sunday Politics Scotland in March, Leonard said if Labour took power in Westminster the party would refuse to grant a “Section 30 order” giving Holyrood the power to hold another vote.
Leonard added: “What we said in the manifesto at the 2017 election was that there is no case for, and we would not support, a second independence referendum.”
However, McDonnell said on Tuesday: “The Scottish Parliament will come to a considered view on that and they will submit that to the Government and the English Parliament itself.
“If the Scottish people decide they want a referendum, that’s for them.”
On Brexit, McDonnell said Labour leader Jeremy Corbyn would “never” step down if other opposition parties demanded it to form a coalition of national unity.
He said: “It won’t happen. I think we’d form a minority government, seek to implement our manifesto and we’d expect the other opposition parties and other MPs to vote for those policies and if they don’t, we’ll go back to the country.
“If they want to vote against a real living wage, if they want to vote against £70 billion worth of investment in Scottish infrastructure, if they want to vote against a green industrial revolution to tackle climate change then so be it, we’ll go back to the people and then let them explain to the people why they wouldn’t support those policies.
“We want to change the world, we’re not going to be held back by other parties.”
Later, the shadow chancellor ruled out standing to be Labour leader in the future and said he would like a woman MP to succeed Corbyn.
He added: “I’ve tried to run for Labour leader twice and I was so popular I didn’t even get on the ballot.”
McDonnell described MPs including Rebecca Long Bailey, Dawn Butler, Emily Thornberry and Laura Pidcock as “incredibly talented” prospective leaders.
“They are committed to transforming the world, they are not career politicians,” he said.
Asked about Jess Phillips, the Birmingham MP who is seen as critical of Corbyn, McDonnell said: “I like Jess, I like her a lot.
“I think she’s got a lot of talent, I just wish she would be a little more praising of Jeremy.”
The senior Labour frontbencher said he was “extremely worried” about new Prime Minister Boris Johnson.
He added: “I think he’s reckless and I think he’s unstable and I will move heaven and earth to stop a no-deal Brexit.”
One area he has previously agreed with Johnson on is in his opposition to Heathrow expansion.
McDonnell said he was still opposed to a new runway, both as a local MP and in light of the “climate emergency”, and he criticised Johnson for being absent from a Commons vote in June 2018 on Heathrow expansion.
Johnson was on a trip to Afghanistan in his capacity as the then foreign secretary at the time of the vote.
As London mayor, Johnson said he would “lay down in front of bulldozers” to stop the building of a third runway at Heathrow.
Commenting on this, McDonnell said: “I have a constituent that’s got a JCB and drives round trying to find him.”
SNP MSP George Adam said later: “It is for the Scottish people to decide upon their future. The Scottish Government has a crystal clear mandate to give them that choice.
“Polling this week shows that they want that choice sooner rather than later - with a majority in favour of the opportunities of independence.
“For any Westminster government to deny that would be a democratic outrage, and Tory posturing on the issue is completely unsustainable.
“We trust this position will now receive the fulsome backing of Richard Leonard and Scottish Labour.”
Scottish Liberal Democrat leader Willie Rennie said: “These comments are astonishingly irresponsible and not in (the) interests of Scotland or the UK.
“It’s bad enough with Boris Johnson bungling on Brexit and independence but to have the Labour Party’s (shadow) chancellor piling in makes it a whole lot worse.
“It’s clear only the Liberal Democrats are robustly standing up for Scotland’s place in the UK and the EU.”
Labour MP for Edinburgh South Ian Murray attacked McDonnell’s comments.
He said: “These are utterly irresponsible comments from John McDonnell that betray our party’s values.
“The Labour Party is an internationalist party founded on a vision of solidarity and we should never seek to appease nationalists, whether they be for Brexit or Scottish independence, who want to divide communities and people.”