Cyanobacteria and myxobacteria exhibit gliding motility that is associated with the secretion of an exopolymeric slime through nozzle-like structures. Using a combination of biochemical and structural approaches, we demonstrate that these nozzles are composed of secretins belonging to the PilQ/GspD family; proteins previously characterized as forming outer membrane gates in type-two secretion systems (T2SSs) and other bacterial secretion machineries. We show that gspD is an essential gene in Myxococcus xanthus, and that its conditional knockdown impairs both A-motility-associated exopolymer (AEP) slime secretion and gliding motility. In cyanobacteria, available data indicate that the exopolymeric slime is a polysaccharide, whereas the precise composition of the slime in myxobacteria remains unresolved. These findings suggest that secretins can mediate the secretion of non-proteinaceous polymers in certain bacteria.