And behold there appeared to them Moses and Elijah. And why did they appear? Chrysostom assigns the reasons. The first reason is to confirm the faith of the disciples. He had asked above: whom do men say that the Son of man is? etc. And they said: some, Elijah, etc. But in order to show the difference between himself and them, he willed to bring them forth; Psalm 85:8: there is none among the gods like unto you, O Lord, etc. The second reason is to confute the Jews. For they said that he was a transgressor of the law; likewise they said that he was a blasphemer, as is found in John 10:33: for ...a good work we stone you not, but for blasphemy. Therefore, because Elijah was the holiest of all the prophets, and Moses was the lawgiver, he showed himself before Moses and Elijah, because he was not contrary to God, nor a transgressor of the law. The third reason is to show that he is the judge of the living and the dead, because Elijah was living, and Moses was dead. The fourth reason is for the reassurance of Peter; because Peter had rebuked the Lord concerning his death, therefore he shows that those who expose themselves to death are not to be rebuked, by invoking these two; because Elijah exposed himself to death before Jezebel, and similarly Moses exposed himself on account of the law. The fifth reason is that there were two things in him which he willed to show in these two, namely, meekness, which he shows in Moses, and the example of zeal for God, which he shows in Elijah, of whom it is said that Elijah rose up like fire, and his word burned like a torch. The sixth reason is assigned in the Gloss, because all the law and the prophets bore testimony to Christ. Hence Luke 24:44: all things must be fulfilled which are written in the law and the prophets concerning me. But then there is a question. Concerning Elijah it is not surprising if he was there, because he is living; but concerning Moses the question is how he was there. Some have said that an angel was there in his place. But this is nothing, because Moses was there in soul only. But how was he seen? It must be said that he was seen in the way angels are seen.
Source: Commentary on Matthew