Let’s say there’s a software engineer in some company. They’ve been working there for a while, everything’s good, they like the work and their employer’s happy. Now there’s a shortage in another part of the company and since they’ve been doing good work, their employer wants them to move to that department/project. However, they don’t want to, because they don’t like the domain/the team/whatever reason. Is the employer allowed to simply say they have to? If they say no, is that a reason for the employer to fire them?

Brah the boss asks whatever they want. You work at their pleasure. If they want you to wear a clown on your head, you wear a clown on your head.
Not saying this is ideal. Its just how the world works.