The ex-naval captain, who has clashed with the US President despite being in the same party, issued his warning a day after the leader again criticised the press.
Senator McCain said: “The fact is we need you. We need a free press. We must have it. It’s vital.
“If you want to preserve democracy as we know it, you have to have a free and, many times, adversarial press. And without it, I am afraid that we would lose so much of our individual liberties over time. That’s how dictators get started.”
Mr McCain, who stood against Barack Obama in the 2008 presidential election, added: “When you look at history, the first thing dictators do is shut down the press.
“I’m not saying that President Trump is trying to be a dictator. I’m just saying we need to learn the lessons of history.”
Mr Trump has branded negative stories about his administration “fake news”.
Criticising the media, he told supporters at a rally on Saturday: “They just don’t want to report the truth. They have their own agenda, and their agenda is not your agenda.”
Mr Trump also likened himself to predecessors Thomas Jefferson, Andrew Jackson and Abraham Lincoln, saying they had fought against the press.
He went on: “Thomas Jefferson said, ‘Nothing can be believed which is seen in a newspaper’.”
Yet the quote was from a speech where Jefferson backed a free press. The Daily Mail, London, 19 February 2017
The man who brought down President Richard Nixon says Trump is even 'more treacherous'
Watergate journalist Carl Bernstein criticises Donald Trump's 'unhinged conduct' and warns
'The most dangerous ‘enemy of the people’ is presidential lying'
"The most dangerous 'enemy of the people' is presidential lying—always. Attacks on press by @realDonaldTrump more treacherous than Nixon's," Bernstein tweeted.
Real news (not fake) is that @realDonaldTrump trying to make conduct of press the issue instead of egregious (and unhinged)conduct of POTUS.— Carl Bernstein (@carlbernstein) February 18, 2017
The most dangerous 'enemy of the people' is presidential lying—always. Attacks on press by @realDonaldTrump more treacherous than Nixon's.— Carl Bernstein (@carlbernstein) February 18, 2017
He also noted that when the press reported on Hillary Clinton's unauthorized email server, Trump saw journalists as "patriots.
"When focus of press was on Hillary's server—by same 'fake news' orgs/'enemies of the people' cited by @realDonaldTrump—he saw patriots.— Carl Bernstein (@carlbernstein) February 18, 2017
Trump has ratcheted up his rhetoric against the "fake" news media, using part of a press conference Thursday to remark on the "hatred" from journalists.
The president has also taken to Twitter to accuse reporters of making up stories and "'sources'" after leaks about Mike Flynn misleading administration officials on his communications with Russia led to his resignation Monday.
Bernstein is best known for his investigative reporting for the Washington Post that shed light on the Watergate scandal, leading to Nixon's resignation in 1974.
In December, Bernstein warned against Trump's "disdain for the truth."
"Trump lives and thrives in a fact-free environment," Bernstein said on CNN. "No president, including Richard Nixon, has been so ignorant of fact and disdains fact in the way this president-elect does."