Is it legal to force federal employees to work without pay?

About 800,000 federal workers aren’t being paid during this government shutdown. About half of them are “essential workers” and are expected to come to work every day. Now a union for federal employees is suing, saying that’s illegal.