The pbuE adenine riboswitch undergoes metal ion-dependent folding that involves a loop-loop interaction. Binding of 2-aminopurine to the aptamer domain strongly correlates with the ability of the loops to interact, and single-molecule FRET studies reveal that folding proceeds via a discrete intermediate. Folding occurs in the absence of adenine ligand, but ligand binding stabilizes the folded structure by increasing the folding rate and decreasing the unfolding rate, and it lowers the magnesium ion concentration required to promote the loop-loop interaction. Individual aptamer molecules exhibit great heterogeneity in folding and unfolding rates, but this is reduced in the presence of adenine. In the full riboswitch, the adenine binding domain fails to fold because of conformational competition by the terminator stem. Thus, riboswitch function should depend on the relative rates of ligand binding and the transcriptional process.