Malachi 3:1 is a dual-fulfillment prophecy. Many biblical prophecies have dual-fulfillments, where the prophecy is kinda-met, but not fully, sometimes called a "shadow fulfillment" or a "near/short-term fulfillment", until the full fulfillment later comes.
In Malachi 3:1's case, the shadow fulfillment was Jesus' first coming. The full fulfillment is Jesus' second coming.
On the surface, Malachi 3:1 mentions two individuals, and one or two groups of people: the messenger coming before the Lord, the Lord coming Himself, those who can stand before the Lord, and the sons of Levi who get purged like silver and gold.
(I think the latter two groups of people are the same group, but am not certain)
`Behold, I will send my messenger, and he shall prepare the way before me`
The first person is one who comes as a messenger, preparing the way before God.
The Jews were expecting this to be Elijah, but Jesus seems to say it's John the Baptist.
So let's go back a moment, why were the Jews expecting Elijah? Because God told them He'll send Elijah, specifically, in Malachi 4:5-6:
“Behold, I am going to send you Elijah the prophet before the coming
of the great and terrible day of the Lord. He will turn the hearts
of the fathers back to their children and the hearts of the children
to their fathers, so that I will not come and strike the land with
complete destruction.”
If God says "Elijah", He probably means "Elijah".
But Jesus tells his disciples something odd, in Matt 17:10:
"And His disciples asked Him, “Why then do the scribes say that Elijah
must come first?” And He answered and said, “Elijah is coming and
will restore all things; but I say to you that Elijah already came,
and they did not recognize him, but did to him whatever they
wanted. So also the Son of Man is going to suffer at their hands.”
Then the disciples understood that He had spoken to them about John
the Baptist."
This is weird. Jesus is saying (my words, paraphrasing Jesus, using my flawed understanding), "Yes, they are correct, Elijah is coming [future tense]. And when he comes, he will [future tense] restore all things. But also, Elijah has already came" [and the Elijah who already came, the disciples comprehended and scripture confirms was John the Baptist].
So, there is two fulfillments of the Malachi 4:5 passage: Before Jesus' first coming, John the Baptist is the shadow-fulfillment playing the role of Elijah, the Malachi 4:5 role, to prepare the way for Christ's [first] coming.
But God said He'd send Elijah, and Jesus confirms Elijah is still yet to come, and will "restore all things", When? Malchi 4:5 says, before the coming of the Great and Terrible Day of the Lord. i.e. Christ's second coming.
There are many Old Testament prophecies of the Day of the Lord, and they weren't fulfilled at Christ's first coming.
Indeed, the apostles frequently wrote - after Christ's first coming - as if it's still yet to come. Take the whole of 2nd Peter chapter 3 as a good example.
Peter is talking of a future event, and his future event sounds like it meshes well with Malachi 3:2-3:
"But who may abide the day of his coming? and who shall stand when he appeareth? for he is like a refiner's fire, and like fullers' soap: 3 And he shall sit as a refiner and purifier of silver: and he shall purify the sons of Levi, and purge them as gold and silver [...]
I don't feel like this has been fulfilled. I also don't feel like John the Baptist fulfilled "restore all things".
Now, Elijah did show up during Jesus' first coming, along with Moses, on the Mount of Transfiguration, but only three people aside from Jesus saw him, and he didn't turn the hearts of the children to the fathers or restore all things, so that can't have been the fulfillment either.
So when then is Elijah supposed to appear?
We see he's supposed to appear before the coming of The Lord, before the coming of the Great and Terrible Day of the Lord (a day the Bible describes in fairly destructive language).
And when we turn to Revelation 11, we see that God will send, in the end-times, two witnesses, who prophecy and who do signs and wonders, and the signs and wonders listed are thus:
- breathing deadly fire
- commanding the sky to shut up the rain
- turning water to blood
- striking the land with plagues
The first two are famously what Elijah did in the Old Testament. The last two are what Moses did in Egypt. Both Elijah and Moses appeared with Jesus on the mount of transfiguration.
The Revelation 11 passage that describes the two witnesses, says the two witnesses, "are the two olive trees and the two lampstands that stand before the Lord of the earth." (Rev 11:4)
This is a direct reference to Zech 4, wherein Zechariah has a vision, and talks with an angel about the vision, and the angel tells him in Zech 4:14: "These are the two anointed ones, who stand beside the Lord of the whole earth."
So if I may lay it out like this:
- Zechariah sees two olive trees and lampstands that are two anointed people who stand before the Lord of the earth.
- Revelation says the Two Witnesses are those two people, and will witness before Christ's 2nd coming in Jerusalem (to the ""sons of Levi"", perchance? Religious/Orthodox Jews who are loyal to the OT, maybe?).
- Revelation says those two witnesses will do miracles that are suspiciously similar to what Moses and Elijah did.
- Moses and Elijah appeared with Christ transformed on the mountain.
- Malachi says (and Christ confirms) God will send Elijah before the coming of the Lord to prepare His way.
So what is the preparing of His way?
I think John the Baptist (1st coming) and Elijah (2nd coming) minister to people's hearts and call them to repentance, making them more likely to turn to Christ when Christ appears. I'm not exactly sure how Elijah "restores all things" when he appears 3 1/2 years or more before Christ's second coming. Perhaps he restores them to proper doctrine, to prep them for the arrive of Christ as fulfillment of that doctrine? I am not sure.