I have been caught in sea fog a few times. It is certainly not fun. We have lots of jet skis around and the power boaters don't slow down for much. I just try to get to the beach and wait it out. Usually you can see it rolling in. If you sail into it… you can turn around and sail out to get to a beach.
I have also been caught out when the wind dies and don't get back to beach until well after sunset. I now carry flashlights, emergency strobe lights, and a compass at all times. Plus my cell phone in a waterproof bag. This doesn't help all that much in dense fog, but I am glad to have it when I need it.
In our re-scheduled... hangover regatta (Dunedin Fl) we had fog roll in that blinded the most seasoned sailors. It was so bad they couldn’t tell what direction they were headed, where they came from or where the beach was (this is in the Gulf of Mexico, just offshore). A bunch of cats tied themselves together and floated around until they could see.