When politicians shut down the federal government, some federal workers are ordered to work without pay. To illustrate, TSA and Coast Guard personnel are often ordered to keep working even when their pay is frozen. This raises the moral question of whether it is ethical to compel federal workers to work without pay. The ethics of the matter are distinct from the legality of unpaid labor. That is a matter for the courts to sort out based on what they think the laws say.
A sensible starting point is to note that federal workers should expect politicians to shut down the government and freeze their pay. Since the workers accepted the jobs, they seem to have consented to work without pay. This would appear to make it ethical to force them to work without pay. This assumes the workers signed the contracts without being under duress and knowing they would be required to work without pay under certain conditions. If the workers were not properly informed or the contracts were accepted under duress, then they would have no moral obligation to obey such a forced or fraudulent agreement. That said, there is still a concern about what people can ethically agree to.
Philosophers have, of course, considered whether there are limits to what people can agree to. For example, it has been argued that a person cannot freely agree to become a slave. As such, it is worth considering whether a person can agree to do normal paid labor for free because of a government shut down.
One way to approach is to consider that people do agree to work for free. A good example is volunteer work: this unpaid labor is not only acceptable, but often praiseworthy. As such, it would be absurd to claim it is wrong for people to agree to work for free. But what if someone is compelled to work for free? That is, what if they cannot quit and are forced to work for free? This would seem to be something that a person cannot ethically agree to. They are, in effect, agreeing to a form of slavery in which they must work but are not paid and cannot quit. Even if they were paid, it would still be a form of slavery. A key aspect of slavery is not working without compensation, but the lack of freedom. Not being compensated simply makes it worse. As such, federal workers should be free to quit immediately and without any consequences. Otherwise, the state would be claiming a right to enslave citizens, which is morally wicked.
It might be argued that those who entered into long-term agreements with the state, such as a term of service, are obligated to stay in the job and quitting because they are not getting paid would be wrong. While this has some appeal, this would mean accepting that a person can, morally, be locked into working without compensation even when doing so would be harmful. This expects too much of people. Naturally, it could be countered that if they freely entered into a long-term agreement that included the possibility of working without pay, then they are obligated to stick to that agreement—even if they are harmed. After all, a contract is a contract.
While this does seem sensible, it also seems sensible to argue that such agreements should not include the possibility that there will be no pay. That is, it is immoral for this to be included in agreements of this sort, even if people agree to accept the terms. As such, federal workers should always be paid for their work or allowed to terminate their agreements with no harmful consequences being imposed. After all, no one has the right to expect people to labor for free and to demand this would be immoral.