N-linked protein glycosylation is found in all domains of life. In eukaryotes, it is the most abundant protein modification of secretory and membrane proteins, and the process is coupled to protein translocation and folding. We found that in bacteria, N-glycosylation can occur independently of the protein translocation machinery. In an in vitro assay, bacterial oligosaccharyltransferase glycosylated a folded endogenous substrate protein with high efficiency and folded bovine ribonuclease A with low efficiency. Unfolding the eukaryotic substrate greatly increased glycosylation. We propose that in the bacterial system, glycosylation sites are located in flexible parts of folded proteins, whereas the eukaryotic cotranslational glycosylation evolved to a mechanism presenting the substrate in a flexible form before folding.