The short answer is the Bible does not tell us who they will be. Therefore only God knows the answer. However, this does not stop many theologians and others including us from speculating.
The one most common suggestion is that they will be Moses and Elijah, since they were present on the Mount of Transfiguration with Jesus and the three disciples; Peter, James and John. (see, Mark 9:2-4)
The next most common speculation is that it will be Elijah and Enoch, as these are the only two who did not experience physical earthly death. Others say they will be two new unknown individuals specially chosen by God. The honest answer is that we do not know whom but we are certain that they will be real men.
As to their purpose, it is to prophecy. Now to prophecy means two things; to declare the Word of God and/or to declare what is going to occur in the future. Picture two Billy Graham types proclaiming the Gospel.
In addition these two men will have supernatural powers, and their testimony to Israel, Jerusalem, and the world will be true and profound. Anyone that tries to harm them will themselves be reduced to ashes by fire from heaven. (See Revelation chapter 11 for the rest of the story)
This will occur in the Tribulation Period probably during the first 3.5 years or 1260 days. Remember that all who believe in Christ will have been taken out previously. The interesting aspect of this prophecy is that the entire world will be able to witness these two men. 100 years ago it was a mystery and thought impossible but today we have global satellite television. And just remember that the Apostle John was given this vision over 1900 years ago, confirming once again that the Bible is the inspired Word of God since God alone knows the future.
Now how about you? Have you already committed your life to God?