Fog will form if the air temperature drops below the dew point, which is the capacity of the air to hold moisture in suspension. If the temperature drop far enough the moisture content will exceed saturation point, causing it to form visible water vapour.
It happens in the early mornings or late after noons.