A contractor would agree because it basically it comes close to restating the state of the law in the absence of any agreement between the parties.
So contrary to the answer of ShazamoMorebucks it probably would be enforced. Sometimes contracts that waive liability that would otherwise exist in the absence of an agreement are viewed as objectionable. But, a requirement in a contract that simply places upon a party the liability that they would have in the absence of an agreement is usually enforced.
The Subcontractor agrees to indemnify and hold harmless [the
contractor] and the United States Government, and their respective
officers, employees and agents (the "Indemnities"), from and against
any and all liabilities, of whatsoever kind or nature, arising out of
or in any way connected with the Subcontractor's performance under
this Agreement, excepting only (i) liability arising from affirmative
acts, done with intent to cause loss, damage or injury, by the
Indemnities; (ii) liability arising from the sole negligence of the
Indemnities; or (iii) any express liability as may be specified
elsewhere in this Agreement.
The big limiting factor here is that the liability must arise out of or be connected with the Subcontractor's performance under the Agreement.
Usually, if liability arises from the Subcontractor's performance, the Subcontractor would be, at least, jointly and severally liable for the liability in any case, where liability does not arise from the other party's intentional acts, or from the other party's sole negligence.
Liability for defects in goods sold is generally a matter of strict liability.
If the Subcontractor did defective work, and the general contractor simply purchased that work and did nothing else to contribute to the liability, why should it be on the hook?
The only case where this may modify the default rule is when both the subcontractor and the general contractor are at fault. For example, maybe the subcontractor made a defective good but the defect was so obvious that the general contractor should have noticed a returned the goods before using them in a larger project. This puts full liability on the subcontractor, even when the general contractor is also negligent.
But, in practice, the general contractor will still be on the hook for most of the liability that the general contractor is forced to pay, because the subcontractor will generally be almost judgment proof and will go bankrupt before it pays a small portion of the amount that it owes to the general contractor in the event of the subcontractor's fault giving rise to a major liability (e.g. if goods it supplied caused a multi-million dollar project to have to be done over from scratch).
Also, subcontractors routinely can and do insure against this risk and figure the cost of the insurance into their prices. Working on a federal government subcontract can be a source of lots of business, and this is worth it if the primary risks can be insured against and the insurance cost can be recovered in the price charged for the work.