The gut microbiota is central to the pathogenesis of several inflammatory and autoimmune diseases. While multiple mechanisms are involved, the immune system clearly plays a special role. Indeed, the breakdown of the physiological balance in gut microbial composition leads to dysbiosis, which is then able to enhance inflammation and to influence gene expression. At the same time, there is an intense cross-talk between the microbiota and the immunological niche in the intestinal mucosa. These interactions may pave the way to the development, growth and spreading of cancer, especially in the gastro-intestinal system. Here, we review the changes in microbiota composition, how they relate to the immunological imbalance, influencing the onset of different types of cancer and the impact of these mechanisms on the efficacy of traditional and upcoming cancer treatments.