A chain of magnetic atoms with noncollinear spin configuration on a superconductor is a promising new system that can host Majorana fermions (MFs). In this study, we clarify that in the presence of MFs, an odd-frequency Cooper pair is generated at the edge of the chain. Furthermore, it is revealed that this feature is robust against the distance between magnetic atoms as far as this distance is shorter than the coherence length of the superconductor. We also elucidate the close relationship between the pair amplitude of the odd-frequency pair and the direction of the MF spin. If Rashba-type spin-orbit coupling is included, MFs can be realized even in a collinear alignment of magnetic atoms, i.e., in a ferromagnetic or an antiferromagnetic chain on a superconductor. Then, the odd-frequency pairing is generated at the edge, similar to the noncollinear case. Based on our results, it can be concluded that the detection of the zero-energy peak of the local density of states by scanning tunneling microscopy at the edge of the magnetic chain is strong evidence for the generation of odd-frequency pairing.