Since California passed Proposition 13 in 1978, property tax rates for those San Franciscans who owned property back then have been severely capped. Owners may pay Nixon-era property tax rates, while renting out those spaces at rates that have exploded in the last 40 years. They, too, can afford to let buildings sit empty.
There have also been vacancy taxes proposed: https://reason.com/2019/12/10/san-francisco-ballot-measure-w..., but Prop 13 reform would seem to be the more obvious route.