In an announcement on Tuesday, Cindy McCain described her husband – the late Republican senator and Vietnam veteran – as someone who was “country first”, as she explained her decision.
"My husband John lived by a code: country first," wrote Ms McCain on Twitter. "We are Republicans, yes, but Americans foremost.”
She added: “There’s only one candidate in this race who stands up for our values as a nation, and that is Joe Biden.”
Ms McCain made the announcement earlier on Tuesday during a virtual fundraiser for the Democratic presidential nominee, Mr Biden.
She told a virtual audience that she decided to endorse the Democrat after a report by The Atlantic detailed Donald Trump’s derogatory comments about US soldiers, who were said to have been labelled “losers” and “suckers”.
Denying those comments, the US president also disputed having called McCain, a veteran of the Vietnam war, a “loser”.
“I hardly know Cindy McCain other than having put her on a Committee at her husband’s request,” wrote Mr Trump in response to the endorsement, saying: “Joe Biden was John McCain’s lapdog.”
He added: “Never a fan of John. Cindy can have Sleepy Joe!”
The president and McCain had a difficult relationship, with Mr Trump having claimed before becoming president that the Republican lawmaker was “not a war hero” because he was captured in Vietnam.
Speaking in 2015, Mr Trump said of McCain: "He’s not a war hero. He was a war hero because he was captured. I like people who weren’t captured.”
Ms McCain’s endorsement of Mr Biden comes after more than 100 former McCain staffers announced their support for the Democratic nominee last month.
She was also among a handful of Republicans to appear in a video on Mr Biden’s behalf at the Democratic National Convention in August.
McCain, who represented Arizona in the US Senate for more than three decades and was the 2008 Republican presidential nominee, died of brain cancer in 2018.
Additional reporting by Reuters