Can they do that?
Yes, in general an employer can alter the terms and conditions of your employment for any reason or no reason, so long as it is not an illegal reason. Your pay, work assignments, or even your continued employment can be changed (or ended) by your employer for most reasons, for no reason, or even "for no good reason."
BUT it is illegal for an employer to discriminate against you because of a protected trait. That means you cannot be fired, demoted, or not hired because of your race, color, age, national origin, sex, disability, pregnancy, or religion. It is also illegal for an employer to retaliate against you for reporting or complaining about employment discrimination or illegal harassment, requesting an accommodation for a disability, or for requesting protected leave.
Read more about specific types of employment claims: