Oligosaccharyltransferase transfers an oligosaccharide chain to the asparagine residues in proteins. The archaeal and eubacterial oligosaccharyltransferases are single subunit membrane enzymes, referred to as "AglB" (archaeal glycosylation B) and "PglB" (protein glycosylation B), respectively. Only one crystal structure of a full-length PglB has been solved. Here we report the crystal structures of the full-length AglB from a hyperthermophilic archaeon, Archaeoglobus fulgidus. The AglB and PglB proteins share the common overall topology of the 13 transmembrane helices, and a characteristic long plastic loop in the transmembrane region. This is the structural basis for the formation of the catalytic center, consisting of conserved acidic residues coordinating a divalent metal ion. In one crystal form, a sulfate ion was bound next to the metal ion. This structure appears to represent a dolichol-phosphate binding state, and suggests the release mechanism for the glycosylated product. The structure in the other crystal form corresponds to the resting state conformation with the well-ordered plastic loop in the transmembrane region. The overall structural similarity between the distantly related AglB and PglB proteins strongly indicates the conserved catalytic mechanism in the eukaryotic counterpart, the STT3 (stauroporine and temperature sensitivity 3) protein. The detailed structural comparison provided the dynamic view of the N-glycosylation reaction, involving the conversion between the structured and unstructured states of the plastic loop in the transmembrane region and the formation and collapse of the Ser/Thr-binding pocket in the C-terminal globular domain.