In the human intestinal tract, there are more than 100 trillion symbiotic bacteria, which form the gut microbiota. Approximately 70% of the human immune system is in the intestinal tract, which prevents infection by pathogenic bacteria. When the intestinal microbiota is disturbed, causing dysbiosis, it can lead to obesity, diabetes mellitus, inflammatory bowel disease, rheumatoid arthritis, multiple sclerosis, autism spectrum disorder and cancer. Recent metabolomics analyses have also made the association between the microbiota and carcinogenesis clear. Here, we review the current evidence on the association between the microbiota and gastric, bladder, hepatobiliary, pancreatic, lung and colorectal cancer. Moreover, several animal studies have revealed that probiotics seem to be effective for the prevention of carcinogenesis to some extent. In this review, we focused on this relationship between the microbiota and cancer, and considered how to prevent cancer using strategies involving the gut microbiota.