A garment that has a tzara’as infection in it, a garment of wool or a garment of linen… (Leviticus 13:47)
Tzara’as didn’t only infect people. Here we see that a tzara’as blemish could appear on a garment or in threads on a loom, as well as on leather. As with human tzara’as, the garment or material must be shown to a kohein to evaluate.
A tzara’as infection on material or cloth was green or red in color. Wool and linen were the only fabrics that were susceptible to tzara’as, from the time that they were fit to be woven into a useful item. (So, for example, lumps of wool right off the sheep’s back would not be able to contract tzara’as.)
A garment suspected of tzara’as would be quarantined, then re-inspected a week later, the same as in the case of tzara’as in a person. If the garment is ultimately deemed infected, it is burned. If the stain fades after washing, it is cut out but the garment itself can be salvaged.
The reason for this mitzvah is that God is merciful. Before He sends tzara’as to affect someone bodily, He sends it to some garment. This is not a natural occurrence, so hopefully it will catch the person’s attention and serve as a wake-up call. If the person gets the hint and ceases speaking ill of others, he may be spared receiving tzara’as on his body.
This mitzvah applied to both men and women when there were kohanim who could diagnose tzara’as. The details of this mitzvah are discussed in the Mishna in tractate Negaim; in the Talmud, see tractate Shabbos, pages 26b-27a. It is codified in the Mishneh Torah in the twelfth and thirteenth chapters of Hilchos Tumas Tzara’as and is #102 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos.