Cave adaptation is caused by dwarves spending too much time underground with insufficient exposure to outdoor sunlight.
Exposure of cave-adapted dwarves to outdoor sunlight can cause two negative thoughts: "irritated by the sun" and "nauseated by the sun". The latter results from more severe cave adaptation and triggers profuse vomiting, which can leave an otherwise capable soldier momentarily defenseless. Cave adaptation causes no problems if the affected dwarves simply remain underground.
Note that only dwarves suffer from cave adaptation. Consider accepting a few non-dwarven mercenaries for outdoor combat.
Cave adaptation can be prevented by regular exposure to outdoor sunlight, which can be achieved by having an outdoor meeting area or high-traffic areas above ground.
Cave adaptation can be treated by exposing dwarves to outdoor tiles. However, due to the negative thoughts brought about by exposure to light in cave-adaptated dwarves, these outdoor areas should be well decorated with statues or the like. This should provide enough positive thoughts to negate those caused by cave adaptation.
A dwarf who is completely adapted to life underground can be cured in a little over nine weeks of constant exposure to outdoors light.