Numerous bacteria are harbored in the animal digestive tract and are impacted by several factors. Intestinal microbiota homeostasis is critical for maintaining the health of an organism. However, how pathogen invasion affects the microbiota composition has not been fully clarified. The mechanisms for preventing invasion by pathogenic microorganisms are yet to be elucidated. Zebrafish is a useful model for developmental biology, and studies in this organism have gradually become focused on intestinal immunity. In this study, we analyzed the microbiota of normal cultivated and infected zebrafish intestines, the aquarium water and feed samples. We found that the predominant bacteria in the zebrafish intestine belonged to Gammaproteobacteria (67%) and that feed and environment merely influenced intestinal microbiota composition only partially. Intestinal microbiota changed after a pathogenic bacterial challenge. At the genus level, the abundance of some pathogenic intestinal bacteria increased, and these genera included Halomonas (50%), Pelagibacterium (3.6%), Aeromonas (2.6%), Nesterenkonia (1%), Chryseobacterium (3.4‰), Mesorhizobium (1.4‰), Vibrio (1‰), Mycoplasma (0.7‰) and Methylobacterium (0.6‰) in IAh group. However, the abundance of some beneficial intestinal bacteria decreased, and these genera included Nitratireductor (0.8‰), Enterococcus (0.8‰), Brevundimonas (0.7‰), Lactococcus (0.7‰) and Lactobacillus (0.4‰). Additionally, we investigated the innate immune responses after infection. ROS levels in intestine increased in the early stages after a challenge and recovered subsequently. The mRNA levels of antimicrobial peptide genes lectin, hepcidin and defensin1, were upregulated in the intestine after pathogen infection. These results suggested that the invasion of pathogen could change the intestinal microbiota composition and induce intestinal innate immune responses in zebrafish.