Life in desert soil is marked by episodic pulses of water and nutrients followed by long periods of drought. While the desert flora and fauna flourish after rainfall the response of soil microorganisms remains unclear and understudied. We provide the first systematic study of the role of soil aqueous habitat dynamics in shaping microbial community composition and diversity. Detailed monitoring of natural microbial communities after a rainfall event revealed a remarkable decrease in diversity and a significant transition in community composition that were gradually restored to pre-rainfall values during soil desiccation. Modelling results suggest a critical role for the fragmented aqueous habitat in maintaining microbial diversity under dry soil conditions and diversity loss with wetting events that increase connectivity among habitats. This interdisciplinary study provides new insights into wetting and drying processes that promote and restore the unparalleled microbial diversity found in soil.