In order to answer your question it is necessary that we understand some things not so evident in Malachi itself. The Old testament is basically a synopsis of God's will in opposition to man's fragility and Satan's deviousness. The New Testament is on the other hand God's solution to the enigma.
In the Old Testament man consistently demonstrates his inability to adhere to God's will and an insistence in evil ways. In the New Testament God is offering a path by which man can be retrieved, but only through the obedience of another.
The book 0f Malachi is strategically placed between the Old and New Testaments.It effectively closes out the Old Testament or as some consider it 'the book of Law'.
Commentary by AR Faussett.
Malachi forms the transition link between the two dispensations, the Old and the New, “the skirt and boundary of Christianity”
Malachi is warning the Nation of Israel that God has lost patience with Israel, and what he is about to do is to abandon his efforts to have them conform, so that he can be their God and they can be his people. He is going to institute a new and revolutionary plan based not on man's fulfillment of the Law, but the fulfillment the Law by another, and His grace in allowing substitution of another's adherence to the Law through Faith.
Matthew 5:17 Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil.
The Book of Malachi spans both the Old and New Testaments. And chapter 4 is the culmination of the transition between the two.
Excerpts from the Commentary by David Guzik.
Malachi 4 - The Sun of Righteousness
A. The final resolution.
- (1) Resolution of the wicked.
"For behold, the day is coming, burning like an oven, and all the proud, yes, all who do wickedly will be stubble. And the day which is coming shall burn them up," says the LORD of hosts, "That will leave them neither root nor branch."
a. The day is coming: Discouraged by the apparent prosperity of the wicked and uselessness of serving the LORD, God's people needed to be reminded that the day is coming. God still has eternity to right all wrongs and reward all good.
b. Burning like an oven: God promised a fire for His people (Mal. 2:2-3) and here He promises a fire for the wicked. But there is a big difference between the refining fire applied to God's people and the burning fire against the ungodly.
c. All who do wickedly will be stubble: Stubble is the unusable part of the grain, and lasts only moments if it is thrown into a fire.
d. Leave them neither root nor branch: In that coming day the wicked will have no hope of shooting up again to life. As long as a root remains there is hope, but hope is gone for these because the judgment of eternity is final.
Malachi is warning Israel of the coming Judgment, and telling them that the riches of this World cannot save them in that judgment, and even though that judgment may seem far away , God has all of eternity right all wrongs.
And now to answer you question about the meaning of turning hearts.
- (5-6) Elijah will come.
"Behold, I will send you Elijah the prophet before the coming of the great and dreadful day of the LORD. And he will turn the hearts of the fathers to the children, and the hearts of the children to their fathers, lest I come and strike the earth with a curse."
a. I will send you Elijah the prophet: In this unique promise, God assures that He will send Elijah to Israel again before the great and dreadful day of the LORD.
i. This was fulfilled in John the Baptist in a figurative sense (Mat. 11:14, Mar. 9:11-13, Luk. 1:17). Yet because this Elijah comes before the coming of the great and dreadful day, we know that the Elijah prophecy is only completely fulfilled before the Second Coming of Jesus. Joh. 17:11-12 and Rev. 11:3-12 speak of this future fulfillment, when God will either send Elijah back to the earth on this special errand, or send someone uniquely empowered in the spirit and office of Elijah.
ii. In anticipation of this, Jewish homes set a place at the table for Elijah at Passover, just in case he might come on that night to announce the news that Messiah has come. The empty chair and the cup that is filled but never drank is a testimony to their anticipation of Elijah's coming.
b. Elijah the prophet: Why Elijah? Because he ministered in a time of crisis in Israel, when the nation was far from God, and a time that immediately preceded a terrible judgment.
i. It is significant that in these closing words of the Old Testament, God makes reference to both Moses and Elijah. They both met God at Mount Sinai (Exo. 3:1; 1Ki. 19:8-18). They also both met Jesus at the Mount of Transfiguration (Mat. 17:1-5). They are probably the two witnesses of Revelation 11.
d. He will turn the hearts of the fathers to the children: This promise speaks of more than the reconciliation of families. When God turns the hearts of the children to their fathers, it also has in mind turning to the God of their fathers, to the faith of the patriarchs.
e. Lest I come and strike the earth with a curse: The Old Testament ends with the threat of a curse, but also with the expectation of a new dawning of the Sun of Righteousness.
i. This ending of the Book of Malachi bothered the ancient Jews. "The Masorites, who have given us most of the copies of the Hebrew Old Testament we have . . . were so bothered by this that they repeated the next-to-the-last verse of Malachi after the last verse. Similarly, the Septuagint reverses the last two verse so the Old Testament ends, not with a curse, but with a blessing." (Boice)
ii. The end of the New Testament recognizes the rising of the Sun of Righteousness: The grace of our Lord Jesus Christ be with you all! (Rev. 22:21)
As David Guzik points out the turning of the hearts of fathers and sons has to do with the restoration of the family, but has a broader application in that has to do with the turning of man's heart to God through faith in Jesus Christ.
With the coming of Jesus the battle is changed in that without a Savior once man sinned he was under the power of Satan with no hope of ever regaining his camaraderie with God. This in effect shifted the war in Heaven to the Earth and began a new battle for the hearts and souls of man.
What Jesus is referring to in chapter 10 of Matthew is how divisive that war will become where Satan will pit the unsaved children against the Saved parents and vice versa.
Matthew 10:32 through 34 Whosoever therefore shall confess me before men, him will I confess also before my Father which is in heaven. But whosoever shall deny me before men, him will I also deny before my Father which is in heaven. Think not that I am come to send peace on earth: I came not to send peace, but a sword.
Verses 32 and 33 serve as an explanation for verse 34.
Jesus is telling us that with this war between himself and Satan for the souls of man that there will be deep division between his follower and Satan's followers, even to the splitting of families.
We see this prophesy by Jesus playing out in the Middle East right now, where families are calling for the murder of other family members who convert to Christianity.
So what we see is that that Malachi and Jesus are actually talking about two different situations.
Hope this helps.