We were just in SFO on our Oceania Regatta cruise. ( see comments in Oceania blog)
The terminal at Pier 27 requires you to wear a mask. And they are very strict about it.
So just as you are walking in put it on and just as you are walking out take it off. That is both going on or going off the ship.
Pier 39 is 1.6 mile walk to the right on Embarcadero Street. Flat, and wide sidewalk.