Misfolding of proteins causes many devastating pathologies, such as Alzheimer’s disease. To cure these illnesses, one needs to understand how and when proteins start to misfold. Therefore, we studied the folding behavior from the moment the ribosome produces a protein. During folding, the model protein flavodoxin temporarily produces a misfolded intermediate that aggregates extensively. We investigated formation of this species and the effect the ribosome has thereon. We found that the ribosome affects protein folding and can prevent this intermediate from forming. Once the ribosome has pushed the protein to the properly folded state, binding of the protein’s cofactor stabilizes the protein against degradation in the cell. These findings can potentially be used to develop strategies to ameliorate or prevent misfolding of proteins while they are produced.