The process by which a protein chain folds into its three-dimensional structure, which is essential for the protein to function properly.