Foregut fermentation occurs in mammalian ruminants and in one bird, the South American folivorous hoatzin. This bird has an enlarged crop with a function analogous to the rumen, where foregut microbes degrade the otherwise indigestible plant matter, providing energy to the host from foregut fermentation, in addition to the fermentation that occurs in their hindguts (cecum/colon). As foregut fermentation represents an evolutionary convergence between hoatzins and ruminants, our aim was to compare the community structure of foregut and hindgut bacterial communities in the cow and hoatzin to evaluate the influences of host phylogeny and organ function in shaping the gut microbiome. The approach used was to hybridize amplified bacterial ribosomal RNA genes onto a high-density microarray (PhyloChip). The results show that the microbial communities cluster primarily by functional environment (foreguts cluster separately from hindguts) and then by host. Bacterial community diversity was higher in the cow than in the hoatzin. Overall, compared with hindguts, foreguts have higher proportions of Bacteroidetes and Spirochaetes, and lower proportions of Firmicutes and Proteobacteria. The main host differences in gut bacterial composition include a higher representation of Spirochaetes, Synergistetes and Verrucomicrobia in the cow. Despite the significant differences in host phylogeny, body size, physiology and diet, the function seems to shape the microbial communities involved in fermentation. Regardless of the independent origin of foregut fermentation in birds and mammals, organ function has led to convergence of the microbial community structure in phylogenetically distant hosts.