There appeared to them
They were talking
καὶ ἰδοὺ ὤφθη αὐτοῖς Μωϋσῆς καὶ Ἡλείας συνλαλοῦντες μετ’ αὐτοῦ.
This appearance of Moses and Elijah can be found in all 3 synoptic gospels, Mark, chapter 9:4, Luke, chapter 9:30, and here in Matthew, but there are minor differences in all 3 accounts. Suddenly (καὶ ἰδοὺ), there appeared to the 3 disciples (ὤφθη αὐτοῖς) Moses (Μωϋσῆς) and Elijah (καὶ Ἡλείας), who were talking with Jesus (συνλαλοῦντες μετ’ αὐτοῦ). How did they know what Moses and Elijah looked like? They had never seen them before. They were nearly 1,000 years removed from their existence. Jesus, however, recognized and talked with them, so that is why they might have realized who they were. Thus, Jesus was the fulfillment of the Law of Moses and at the same time the fulfillment of the prophets with Elijah, one of the earliest prophets from the 9th century BCE.