God directs His prophet to approach the spiritual leadership with a legal inquiry that carries a profound message for the generation returning from exile. Haggai is sent to the priests because of their traditional role as the guardians of knowledge and the teachers of the law [אבן עזרא, ביאור שטיינזלץ]. He is instructed to ask them a specific question regarding Torah law, focusing on the rules of purity and impurity [רד״ק].
The purpose behind this legal question is a matter of discussion. The primary approach among commentators is that the inquiry was a test. It was designed to check the priests' knowledge and see if they had forgotten the intricate laws of holiness and purity during their long years of exile in Babylon [רש״י, מצודת דוד, אברבנאל בשם חז״ל].
However, other commentators reject the idea that this was merely a test of knowledge. They point out that the priests, including Joshua the High Priest, were highly educated in the Torah. Moreover, they had already been offering sacrifices on the altar for nineteen years before the Temple was even built, making it highly unlikely that they had forgotten the laws or made practical errors [אבן עזרא, אברבנאל].
According to this perspective, the legal question was not asked for its own sake but served as a metaphor and a rebuke. The priests had grown comfortable simply offering sacrifices on the existing altar, failing to correct the people for their laziness in rebuilding the actual Temple. The question was thus intended to wake them up and push them to finish the construction [אברבנאל]. Furthermore, this legal discussion was meant to illustrate to the people that they were not yet pure or holy enough for the Divine Presence and God's ultimate destiny to rest upon them and the Temple in the end of days [מלבי״ם].