Elijah was the last prophet to hold the sealing power of the Melchizedek Priesthood, the power to bind in heaven ordinances performed on earth, before the time of Jesus Christ. Elijah came to the Mount of Transfiguration to confer the sealing power upon Peter, James, and John. In order to do so, he needed his physical body, since spirits cannot lay hands on mortal beings (See Doctrine and Covenants 129:8).
It’s interesting to note that Elijah also came to earth to confer this same sealing power to Joseph Smith and Oliver Cowdery on April 3, 1836 (See Doctrine and Covenants 110:13-16). At this time, however, he came as a resurrected being, since he was with Christ in his resurrection (See Doctrine and Covenants 133:55).