Is this ethical/legal?

I am sure it is a marketing thing or something so they can say:
“our employees donated X amount of money on top of our donation of X”

My company forces us to donate $5 on Fridays to wear jeans. Not only do they track who donates, but if you are not wearing jeans you look like a jerk. To me its only $5 and its to a good cause so who cares.