Ancient DNA studies have revolutionised the study of extinct species and populations, providing insights on phylogeny, phylogeography, admixture and demographic history. However, inferences on behaviour and sociality have been far less frequent. Here, we investigate the complete mitochondrial genomes of extinct Late Pleistocene cave bears and middle Holocene brown bears that each inhabited multiple geographically proximate caves in northern Spain. In cave bears, we find that, although most caves were occupied simultaneously, each cave almost exclusively contains a unique lineage of closely related haplotypes. This remarkable pattern suggests extreme fidelity to their birth site in cave bears, best described as homing behaviour, and that cave bears formed stable maternal social groups at least for hibernation. In contrast, brown bears do not show any strong association of mitochondrial lineage and cave, suggesting that these two closely related species differed in aspects of their behaviour and sociality. This difference is likely to have contributed to cave bear extinction, which occurred at a time in which competition for caves between bears and humans was likely intense and the ability to rapidly colonise new hibernation sites would have been crucial for the survival of a species so dependent on caves for hibernation as cave bears. Our study demonstrates the potential of ancient DNA to uncover patterns of behaviour and sociality in ancient species and populations, even those that went extinct many tens of thousands of years ago.