A habitat is an environmental area that is inhabited by a particular species of animal, plant or other type of organism. It is the natural environment in which an organism lives. In Crawl, monsters can inhabit dry surfaces, pools of water, and even lava.
For the most part, monsters perform poorly in terrain that is outside their designated habitat. For example, most monsters that live on land are slowed and hindered when entering shallow water and cannot enter deep water without drowning; conversely, monsters that live only in water cannot walk on land. Amphibious monsters are able to move and attack normally both in water and on land. Any monster that is not specifically designed to live in lava will die instantly if it somehow falls in.
There are exceptions, however. Monsters that are Large or larger may attack normally while in shallow water, while monsters that are Giant-sized can walk through deep water as if it was shallow water. Flying monsters can fly over any type of terrain without issue.
Most monsters found in the Dungeon live primarily on land, but some don't: see individual monster pages for details on what habitat a monster lives in.