You have to take Golden Gate Transit from Santa Rosa to San Francisco. Look online for the number of the bus. I think it is 70 or 80. Then you have to transfer at least once more to get to Pier 39.
This site can answer all your questions. Use the trip planner by entering start and destination addresses, it will give you route numbers, rates and schedules.http://www.511.org
You can use the AC transit(the local bus line)actransit.org