Of course they can. Any supplier is free to set terms for how their products are to be used. The DoD is free to not agree to those terms - but it's not free to then claim the company that offered those terms is a security risk, and bar any DoD supplier from using them for any purpose - which is what the extreme measure they took represents.
> but it's not free to then claim the company that offered those terms is a security risk, and bar any DoD supplier from using them for any purpose
Just because you disagree with a power of the government does not mean the government does not have that power.
> but it's not free to then claim the company that offered those terms is a security risk
Yes they are free to do that. You have to blame Congress for giving them that authority under the Federal Acquisition Supply Chain Security Act and specifically 41 U.S.C. § 4713.
But Claude’s ToS didn’t prohibit use of Claude for sensitive military operation but it was coded to do so. It was part of the government’s evidence