The Old Testament tells us that Elijah was taken up into Heaven. This is often taken to mean that Elijah became immortal, in the body, when he arrived in Heaven, and that he has been there in the body ever since. The Bible doesn’t tell us whether this is so.
28 About eight days after Jesus said this, he took Peter, John and James with him and went up onto a mountain to pray. 29 As he was praying, the appearance of his face changed, and his clothes became as bright as a flash of lightning. 30 Two men, Moses and Elijah, appeared in glorious splendor, talking with Jesus. 31 They spoke about his departure,[a] which he was about to bring to fulfillment at Jerusalem. 32 Peter and his companions were very sleepy, but when they became fully awake, they saw his glory and the two men standing with him. 33 As the men were leaving Jesus, Peter said to him, “Master, it is good for us to be here. Let us put up three shelters—one for you, one for Moses and one for Elijah.” (He did not know what he was saying.)
34 While he was speaking, a cloud appeared and covered them, and they were afraid as they entered the cloud. 35 A voice came from the cloud, saying, “This is my Son, whom I have chosen; listen to him.” 36 When the voice had spoken, they found that Jesus was alone. The disciples kept this to themselves and did not tell anyone at that time what they had seen.
--Luke 9: 28-36 NIV
Gospel accounts of the Transfiguration do not tell us whether Moses and Elijah were with Jesus in the flesh or whether they were there in spirit. If they were there in the flesh we might expect that they would descend from Heaven, have a conference with Jesus, and ascend back into Heaven. None of this happens. They simply appear and later disappear. This is perfectly consistent with Moses and Elijah being there in spirit form.
Luke tells us that Peter, James and John were “very sleepy,” which might indicate that what they saw is in the nature of a vision rather than an in-the-flesh encounter with heavenly beings.