Early-life stress is a determinant of vulnerability to a variety of disorders that include dysfunction of the brain and gut. Here we exploit a model of early-life stress, maternal separation (MS) in mice, to investigate the role of the intestinal microbiota in the development of impaired gut function and altered behaviour later in life. Using germ-free and specific pathogen-free mice, we demonstrate that MS alters the hypothalamic-pituitary-adrenal axis and colonic cholinergic neural regulation in a microbiota-independent fashion. However, microbiota is required for the induction of anxiety-like behaviour and behavioural despair. Colonization of adult germ-free MS and control mice with the same microbiota produces distinct microbial profiles, which are associated with altered behaviour in MS, but not in control mice. These results indicate that MS-induced changes in host physiology lead to intestinal dysbiosis, which is a critical determinant of the abnormal behaviour that characterizes this model of early-life stress.