Malachi prophesied to the people of Israel around the same time as Ezra and Nehemiah in the mid-4th century BC. Malachi sets forth 6 segments of indictments (1:2–5; 1:6–2:9; 2:10–16; 2:17–3:5; 3:6–12; 3:13–4:3) against the people of Israel and a conclusion (4:4–6). The people had returned from Babylonian captivity and were not engaging in gross idolatry as before the exile. The charges Malachi makes are not against their orthodoxy, but against the hypocrisy of their hearts. They appear righteous, but God knows the intentions of their hearts. The institution of marriage has become trivial and people have forgotten God's intentions for it. The church had become very human-centered.
But a prophet to-end-all-prophets will appear in the "spirit of Elijah" to make the way for the Lord. He isn't a reincarnation of Elijah, but a prophet that is like Elijah. Elijah lived in the wilderness and wore a hair garment and so did John the Baptist who is the prophet that is spoken of here. He will refine the people to "make straight" the path of the Lord. In Mark 9:13 Jesus makes it clear that John the baptist was the Elijah than was to come.
(3:1) “See, I will send my messenger, who will prepare the way before me. Then suddenly the Lord you are seeking will come to his temple; the messenger of the covenant, whom you desire, will come,” says the LORD Almighty."
(4:4-6) “See, I will send you the prophet Elijah before that great and dreadful day of the LORD comes. He will turn the hearts of the fathers to their children, and the hearts of the children to their fathers; or else I will come and strike the land with a curse.”
- Malachi 1:1-2:9 - "Great Is the Lord" (MP3), by Jim Hamilton