Malachi was one of the three post-exilic writing prophets along with Haggai and Zechariah, and he was quite certainly the last one chronologically, even though we cannot be dogmatic about a date for his writing.
The first group of almost 50,000 Jewish exiles returned from Babylonian captivity under Zerubbabel's leadership in 537 B.C. Ezra 1-6 records their experiences. Haggai and Zechariah ministered to these returnees in 520 B.C. and urged them to rebuild the temple. Zechariah's ministry may have continued beyond that year. The events recorded in the Book of Esther took place in Persia between 482 and 473 B.C. A second group of about 5,000 Jews returned in 458 B.C. under Ezra's leadership. Ezra sought to beautify the temple and institute reforms that would purify Israel's worship (Ezra 7-10). Nehemiah led a third group back of about 42, 000 back in 444 B.C, and the events recorded in his book describe what happened between 445 and 420 B.C. including the rebuilding of Jerusalem's wall. Malachi evidently ministered in Jerusalem during that period.
". . . Malachi's concerns are much different from those of either Ezra or Nehemiah, for he was almost wholly transfixed by concerns about the cult [formal worship].9
Life was not easy for the returnees during the ministry of the fifth-century restoration prophets. The people continued to live under Gentile (Persian) sovereignty even though they were back in their own land. Harvests were poor, and locust plagues were a problem (3:11). Even after Ezra's reforms and Nehemiah's amazing success in motivating the Jews to rebuild Jerusalem's wall, most of the people remained cold-hearted toward Yahweh. Priests and people were still not observing the Mosaic Law as commanded, as is clear from references in the book to sacrifices, tithes, and offerings (e.g., 1:6; 3:5). Foreign cultures had made deep inroads into the values and practices of God's people. The Israelites still intermarried with Gentiles (2:11), and divorces were quite common (2:16). The spiritual, ethical, and moral tone of the nation was low.