Spatial patterns are ubiquitous in animate matter. Besides their intricate structure and beauty they generally play functional roles. The capacity of living systems to remain functional in changing environments is a question of utmost importance, but its intimate relationship to pattern formation is largely unexplored. Here, we address this relationship using dryland vegetation as a case study. Following a brief introduction to pattern-formation theory, we describe a mathematical model that captures several mechanisms of vegetation pattern formation and discuss ecological contexts that showcase different mechanisms. Using this model, we unravel the different vegetation patterns that keep dryland ecosystems viable along the rainfall gradient, identify multistability ranges where fronts separating domains of alternative stable states exist, and highlight the roles of front dynamics in mitigating or reversing desertification. The utility of satellite images in testing model predictions is discussed. An outlook on outstanding open problems concludes this paper.