Upvote:4
You will have to go through immigration (passport/visa control), collect your bags and go through customs in SFO. If the two flights are on the same ticket, your bags will still be tagged to your final destination, and you will be able to drop them at the counter available right after customs (no need to go back to departures for that).
If the second flight is on a separate ticket, you will need to go the the check-in desk for your second flight before the check-in deadline.
You'll then go through security and to your gate (possibly in a different terminal).