It's totally legal, and done all the time: it's why people lease houses rather than go month to month.
It's not a reflection of the market in SF. This happens everywhere a landlord who isn't getting on with their month-to-month tenants and want them out, for whatever reason. It happened to me in 2005. It's not a necessarily a reflection of anything outside of the personal situation of the poster, and their relationship with their landlord.
If this had happened anywhere but SF, there wouldn't be the flurry of hysterical outrage that's exploding on Twitter and Facebook: there would be crickets.