You can not apply for a library on-line however you can get access to digital information, books, movies etc. In order to get a library card you my register with any branch in San Francisco.
You can get a Digital Access Card online
Thanks! Your answer is awaiting moderation.