The raid in the city's Hayes Valley neighborhood occurred around 1:30 a.m. Thursday as officers ordered about 55 people to leave the city-owned property.
Sgt. Dennis Toomer says all but five left the premises. Two were arrested without incident and three others were removed from the trees.
Toomer says one person jumped from a tree and suffered minor injuries.
The land was formerly the site of an urban farm. But it is slated for new a housing development, and city officials planned to remove some trees.
The protesters had been at the space since the beginning of June and called it "Gezi Gardens" after a park in Istanbul that has been the subject of recent protests.