Can the courts hold someone indefinitely for contempt of court?
Yes. This is civil contempt which is imposed to compel compliance with a court order that the disobedient person has the ability to comply with, rather than criminal contempt which is limited to a set time period to punish disrespect for the Court in an instance that is over and complete.
Often, it is eventually vacated on the grounds of futility (i.e. it is clear that further incarceration will not secure compliance) or mootness (e.g. when a witness refuses to testify in a trial and then the trial is completed). In the case of government officials who refuse to comply to an order directed to them in an official capacity, the government official can be released forthwith by resigning from their official post.
Long periods of detention for civil contempt are most common for cases like this where someone refuses to provide the location of something of great value, or in asset protection trust type cases involving millions of dollars worth of assets where the detained person refuses to disclose hidden assets or to take the steps necessary to cause them to be turned over to a creditor or ex-spouse, and the Court has determined that the person detained is capable of doing so. Less often, it is done for quite a long time in cases involving national security secrets.
Persons held in civil contempt also have fewer due process protections than persons charged with indirect criminal contempt which is just a procedurally unusual form of crime (direct criminal contempt is even more procedurally unusual and involves less due process, the person held in direct criminal contempt can be jailed or fined for a set period of time summarily by a judge without a hearing for disrespectful conduct in the judge's physical presence with only a brief few seconds opportunity to speak up for himself or herself without a right to counsel in response before being punished).
When would this situation be considered 'cruel and unusual'
punishment?
No. Cruel and unusual punishment applies to punishment for wrongdoing. Civil contempt isn't designed to punish wrongdoing. It is calculated to secure compliance going forward with a lawful court order with which the person incarcerated has the ability to comply.
In a case of civil contempt, a fundamental principle is that the person detained, who has refused to comply with a court order that the person has the ability to comply with and does so without lawful justification, "holds the key to the jail" and can be released forthwith upon complying with the Court's order at any time.