Coal resource-based cities were once pillars of significant economic and social development, but after resource exhaustion, these cities are at a critical crossroads and need to transition towards sustainable development and ecological urban renewal. The unique landscape patterns of these cities are associated with extensive coal mining, and their dynamic changes are intrinsically linked to habitat quality. However, this relationship has not been fully explored in existing research. Additionally, the spatial-temporal dynamics and non-stationary scale effects of landscape patterns on habitat quality are often overlooked. This study selects Jiawang, a typical coal resource-exhausted city in eastern China, as a case study. We focus on the ecological transition period from 2000 to 2020. Based on land cover data, the study quantitatively describes the spatiotemporal evolution of landscape patterns and habitat quality. A novel multiscale geographically and temporally weighted regression (MGTWR) model is used to analyze and quantify the complex effects of landscape patterns on habitat quality at different spatiotemporal scales. The study further elucidates the dynamic interaction between landscape patterns and habitat quality, emphasizing key non-stationary scale effects. The findings provide insights for strategic ecosystem management and spatial planning, offering a blueprint for the sustainable transformation of coal resource-exhausted cities.