How early you can check your bags for the connecting flight will depend on whether they already have baggage tags on them for that flight or not.
If both flights are on a single ticket, then the carrier for the Singapore -> San Francisco flight should "tag" the bags all the way through to Chicago. When you arrive in San Francisco you will need to collect your bags, but then as soon as you exit the immigration/customs area you can turn left and you will come to the United international connection bag drop area where you will be able to re-check them.
The only exception to this may be if your flight is overnight. Some airlines will not tag your bags for an overnight connection, whilst others will. This is up to the initial airline, and sometimes they will do it anyway if you ask, so if your connection is overnight then you should ask at check-in for the first flight to see if they will tag them all the way through or not.
If you are on 2 separate tickets, especially if those 2 tickets are not on partner airlines (which JAL and United are not) then it's unlikely that your bags will be tagged for your connecting flight. After collecting them at San Francisco you will need to take them to the United Airlines domestic check-in counter (not the bag drop area mentioned above) to check in for your connecting flight - however officially they will NOT accept your bags until 4 hours before your flight. It is possible for them to accept bags earlier, but you'll be at the will of the check-in agents as to whether they will allow it or not.