They were talking
καὶ ὤφθη αὐτοῖς Ἡλείας σὺν Μωϋσεῖ, καὶ ἦσαν συνλαλοῦντες τῷ Ἰησοῦ.
This appearance of Moses and Elijah can be found in all 3 synoptic gospels, Matthew, chapter 17:34, Luke, chapter 9:30, and here in Mark, but there are minor differences in all 3 accounts. Mark said that there appeared to the 3 disciples (καὶ ὤφθη αὐτοῖς) Elijah (Ἡλείας) with Moses (σὺν Μωϋσεῖ). These two 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.