The transition from solitary individuals to societies is considered a major evolutionary transition. An insect society, or colony, is a complex system composed of many interdependent nestmates through whose interactions emerge a certain level of order and robustness. In a termite colony, order and robustness can be considered to be synonymous with division of labour and a social immune system, respectively. How these emergent properties evolved remains a major unanswered question in evolutionary biology. Here, I aim to tackle this topic from a genomic and transcriptomic perspective. First, I engaged in the sequencing of over 47 genomes of termites and cockroaches in order to generate a previously lacking basis of fundamental genomic knowledge, increasing the number of high-quality termite genomes by six-fold. Using this foundation, I first investigated how genomic traits evolved over termite phylogeny, and linked multifaceted patterns of gene and genome evolution to major shifts in termite diet and symbiosis. Secondly, I explored the genomic and genetic bases of sociality by comparing genomes and gene expression patterns across 29 near-chromosome quality cockroaches and termite genomes sampled along a broad spectrum of social complexity, including termite lineages representing convergent transitions towards bifurcated development and true worker phenotypes. Alongside global genomic signatures of selection, I examined patterns of gene family expansion and contraction at key ecological and social transitions. Comparative analysis of differentially expressed genes and co-expression networks are then conducted to search for evidence of conservation and co-option in the termite “genetic toolkit” and to gain insight into the evolutionary origins of termite division of labour. Thirdly, I investigated the evolution of termite immune genes and their relationship with social and ecological traits. I analyzed the evolution of 34 immune gene families and characterized the major components of four canonical immune pathways. I discuss how the evolution of certain immune gene families may have enabled social immunity to evolve and be maintained. Finally, I bring together these two emergent properties, sociality and social immunity, alongside their genomic basis to discuss their commonalities and potential interdependency, and by using sociality in termites as a case study, I consider the potential of a general molecular mechanism for the emergence of evolutionary innovation.