The intestinal microbiota plays an important role in the pathophysiology of depression. As determined, the microbiota influences the shaping and modulation of the functioning of the gut–brain axis. The intestinal microbiota has a significant impact on processes related to neurotransmitter synthesis, the myelination of neurons in the prefrontal cortex, and is also involved in the development of the amygdala and hippocampus. Intestinal bacteria are also a source of vitamins, the deficiency of which is believed to be related to the response to antidepressant therapy and may lead to exacerbation of depressive symptoms. Additionally, it is known that, in periods of excessive activation of stress reactions, the immune system also plays an important role, negatively affecting the tightness of the intestinal barrier and intestinal microflora. In this review, we have summarized the role of the gut microbiota, its metabolites, and diet in susceptibility to depression. We also describe abnormalities in the functioning of the intestinal barrier caused by increased activity of the immune system in response to stressors. Moreover, the presented study discusses the role of psychobiotics in the prevention and treatment of depression through their influence on the intestinal barrier, immune processes, and functioning of the nervous system.