Yes, WD40 can stain clothes. It is a petroleum-based lubricant that contains oil and other chemicals which have the potential to cause staining on many fabrics.
Because of this, it should never be sprayed directly onto clothing or carpeting as there is a risk of permanent damage in some cases.
To prevent any staining due to accidental spray contact with fabric materials when using WD40 products, wear an apron, protective eyewear, and gloves while working.
If possible, also cover surrounding furniture and floor surfaces with plastic sheets before use. If you do come into contact with your clothing by accident – act quickly!
Immediately remove affected articles from the skin, taking care not to spread the product further around yourself, or others present then rinse off thoroughly under running water, then wash according to instructions stated on the garment label – repeating the process until all traces of residue are removed completely prior to drying the item(s).