There are some special rules regarding foreign buyers when you are ready to sell your property around FIRPTA (see below). Depending on your income level, which if you are looking for something in San Francisco is probably on the higher side, you should also probably consult a tax advisor and possibly an attorney as depending on which country you are from can affect how you will want to hold property in the United States.
Also depending on if you are married or not there is a "death tax" that can kick in if a spouse dies that affects foreigners differently than US citizens. This is important as if you or your spouse dies and holds title of the property, there can be significant tax ramifications. Foreigners should consult an experienced estate planner.
Getting financing will also typically be an issue. Lenders will often time require 50% down or more but depending on which country you are from and what records you can provide you may be able to obtain traditional financing. Some countries have limits on what amounts of money can be transferred outside of the country. Also if you have a stock portfolio or other assets to use as security there are other financial options available.
FIRPTA ((Foreign Investment in Real Property Tax) rules can be summarized as there is a 10% withholding by purchaser when buying from a foreign seller. Residents and nonresidents alike are taxed in the U.S. on U.S. real property income and gains. There are some exceptions one of which is that if the purchase price is $300,000 or less and the purchaser is using property as primary home.
I know several specialists in San Francisco who specialize in mortgages, estate planning and tax advice for foreigners. If you want feel free to contact me and we can discuss in more detail.