The Rambam writes that someone who was impure was exempt from Hakhel, because they are unable to enter the Beis Hamikdash. The Minchas Chinuch suggests that there is a distinction depending on what level of Tumah a person has.
A person who has Tumah from becoming a Zav, Zavah, Niddah, Baal Keri or Metzorah, is forbidden to go anywhere on Har Habayis. They would not be able to participate in Hakhel.
The Talmud Bavli is of the view that Hakhel took place in the Ezras Nashim, not in the primary Azarah. This is the ruling of the Rambam.
Someone who had Tumas Meis, was not allowed in the Azarah, but was allowed on Har Habayis. Biblically, the area of the Ezras Nashim is like the rest of Har Habayis, meaning that someone with Tumas Meis would be permitted there.
Even though it is Rabbinically forbidden for someone with Tumas Meis to enter the Ezras Nashim, it could be that for the purpose of joining in the Biblical Mitzvah of Hakhel, the Rabbis did not enforce their decree.