The subject is more nuanced than this.
Firstly, you need to examine the reason why people are on the streets. Generally, it falls into three categories:
1. 'Normal' People with mental illness, and no support network
2. 'Normal' People who have lost their financial stability.
3. Rest (Choice, Addiction, etc. by far the smallest group)
The key thing to note here is that with very, very few exceptions, everyone living on the street was a 'normal' person. The line of being 'normal' and 'homeless' is startlingly slim.
For the majority of people, foundations are job, family and health. Most people can survive losing one, because the others elements support it. Two elements, most people will have problems bouncing back. Three, and you're on the street. Ask yourself: If tomorrow you lost your job and had significant health problem, could you survive? What if you had no family to support you?
Likewise, once on the street, mental health deteriorates rapidly. People wither in a matter of weeks and months. No matter how stoic, strong and determined you think you are - the streets will cripple you.
Once you're on the streets, getting back on your feet is hard. Try getting a job, an apartment, or even a document without a fixed address. It's a vicious circle.
Finally - yes, there are shelters. Unfortunately, most homeless people avoid shelters - as they are notorious spots for theft and abuse; most prefer to risk it on the streets. People aren't refusing help, they're refusing to be sexually assaulted, or have the very few posessions that have left being stolen.
Finally: you're totally right - SF is expensive. You suggest the homeless should leave, but forget the how: buy a plane / train / bus? Or, perhaps they should risk jumping without a ticket, then being arrested, and then having a felony against their name.
The take away message is this: homeless people are 'normal' people. The difference between you, me, and anyone with the homeless is that we're incredibly lucky to not have faced significant problems in life, or be burdened with mental illness.
It's a tough subject, and noone likes the results, but it's worth remembering you're human, and applying empathy.