Environment is known to substantially alter mental state and behaviour across the lifespan. Biological barriers such as the blood–brain barrier (BBB) and gut barrier (GB) are major hubs for communication of environmental information. Alterations in the structural, social and motor environment at different stages of life can influence function of the BBB and GB and their integrity to exert behavioural consequences. Importantly, each of these environmental components is associated with a distinct immune profile, glucocorticoid response and gut microbiome composition, creating unique effects on the BBB and GB. These barrier–environment interactions are sensitive to change throughout life, and positive or negative alterations at critical stages of development can exert long-lasting cognitive and behavioural consequences. Furthermore, because loss of barrier integrity is implicated in pathogenesis of mental disorders, the pathways of environmental influence represent important areas for understanding these diseases. Positive environments can be protective against stress- and age-related damage, raising the possibility of novel pharmacological targets. This review summarizes known mechanisms of environmental influence — such as social interactions, structural complexity and physical exercise — on barrier composition, morphology and development, and considers the outcomes and implications of these interactions in the context of psychiatric disorders.