“filthy garments.” This English translation perhaps understates the situation because it is common to think of “filth” as just a lot of dirt, but that is not the case here. Actually, the primary definition of the English word “filth” is “foul or putrid matter” (Merriam-Webster), which would be correct, but we typically hyperbolize it and, for example, say that a child who has played in the dirt is “filthy.” The Hebrew word for “filthy” is tsow (#06674 צוֹא) and in its unpointed form it refers to excrement (cp. Deut. 23:13; 2 Kings 18:27) or extreme filth, such as “vomit” (Isa. 28:8) or menstrual blood (Isa. 4:4). This explains the translation in the Complete Jewish Bible, which reads that Joshua was “clothed in garments covered with dung.” This, of course, would exclude him from being able to carry out the duties of the priesthood until he was cleansed, which God did.
It seems that Joshua the High Priest is being described as unclean both in his own person and in his representative position for the nation of Israel. Both the priest and the people were unclean before the Babylonian Captivity and during the Babylonian Captivity, especially with the Temple destroyed and thus no proper cleansing sacrifices or Day of Atonement. But now, with the Temple being rebuilt and sacrifices reestablished, both the priest and the people will be able to be clean before God if they will turn their hearts to Him, which many did.