It follows a case brought on behalf of seven individuals who had been blocked by the president.
Officials using social media accounts were not allowed to silence people who disagreed with them, the judge said.
President Trump’s lawyers argued that his Twitter account was a personal one and not subject to those rules.
A US Department of Justice official said it was disappointed by the ruling and was exploring next steps.
In its ruling, the appeals court said: “The First Amendment does not permit a public official who utilises a social media account for all manner of official purposes to exclude persons from an otherwise‐open online dialogue because they expressed views with which the official disagrees.”
The ruling follows one made in May last year by the Court for the Southern District of New York that found the president’s Twitter account, @realDonaldTrump, constituted a public forum.
Another case heard in Virginia ruled in favour of resident Brian Davison, who had been blocked from the Facebook page of a local public official.
“The irony in all of this is that we write at a time in the history of this nation when the conduct of our government and its officials is subject to wide-open, robust debate,” Judge Parker wrote on behalf of a three-judge panel.
The case against President Trump was brought in 2017 by the Knight First Amendment Institute.
Director Jameel Jaffer said of the ruling: “Public officials’ social media accounts are now among the most significant forums for discussion of government policy.
“This decision will ensure that people aren’t excluded from these forums simply because of their viewpoints and that public officials aren’t insulated from their constituents’ criticism.
“The decision will help ensure the integrity and vitality of digital spaces that are increasingly important to our democracy.”
According to the institute, 75 individuals have now been unblocked.
But 30, including author Stephen King and model Chrissy Teigen, remain blocked.