The four basic needs of any animal are food, water, shelter from predators and weather, and adequate space in which to find nourishment and attract a mate. This list presupposes the need for oxygen, without which all animals perish.
While many animals can exist under a range of conditions, their natural habitat provides the optimal conditions under which they can thrive and reproduce. The relationship between an animal and its natural habitat is the result of many generations of adaptation and can be very specific. For example, many desert animals have evolved to obtain all the water they need from the food they eat because their habitat provides very little water.