Fog is, as far as I know, a cloud, just near the ground.
So is it possbile for fog to produce lightning? Unfortunately, I’ve never heard about such occurence.
Fog is just a sort of low cloud, yes, but thunder clouds are not just any old clouds. They get their energy through rising up convectively to great heights (maybe 30,000ft or more), hence the classic “anvil” shape: Cumulonimbus cloud - Wikipedia
So no, you won’t get lightning from fog at low levels. It’s perfectly possible to be inside a thunder cloud if you’re up a mountain, though. In which case it will appear foggy and you probably ought to get out of Dodge.
Although the causes of lightning are still somewhat mysterious, it’s generally thought that the rapid motion of rain (or rarely snow) is one of the chief creators of the electric charges. Also, one needs a large separation between the ground and the cloud to create enough potential difference to actually make a lightning bolt. Fog has neither of these conditions.
As beowulff said, you need a large charge separation to get lightning. Any charge that started to form in fog would quickly bleed off into the earth and dissipate. It is possible to have lightning in fog, but that’s only because it is normal lightning generated in clouds far overhead that happens to pass through the fog. The low lying fog cloud itself doesn’t generate the lightning.
You might be interested to know that you can get lightning in the ash cloud during volcanic eruptions. Here’s one link about it: