Genomic and transcriptomic analyses were performed to investigate non-ribosomal peptide synthetases (NRPS) and polyketide synthases (PKS) in 310 genomes of ruminal/fecal microorganisms. One hundred and nineteen biosynthetic genes potentially encoding distinct NRPs and PKs were predicted in the ruminal microbial genomes and functional annotation separated these genes into 19 functional categories. The phylogenetic reconstruction of the 16S rRNA sequences coupled to the distribution of the three 'backbone' genes involved in NRPS and PKS biosynthesis suggested that these genes were not acquired through horizontal gene transfer. Metatranscriptomic analyses revealed that the predominant genes involved in the synthesis of nonribosomal peptides and polyketides were more abundant in sheep rumen datasets. Reads mapping to the NRPS and PKS biosynthetic genes were represented in the active ruminal microbial community, with transcripts being highly expressed in the bacterial community attached to perennial ryegrass, and following the main changes occurring between primary and secondary colonization of the forage incubated with ruminal fluid. This study is the first comprehensive characterization demonstrating the rich genetic capacity for NRPS and PKS biosynthesis within rumen bacterial genomes, which highlights the potential functional roles of secondary metabolites in the rumen ecosystem.