Treasure hunter freed from jail after refusing to turn over shipwreck gold

https://www.bbc.com/news/articles/cg4g7kn99q3o

Treasure hunter freed from jail after refusing to turn over shipwreck gold

Tommy Thompson spent more than a decade in prison after refusing to disclose the whereabouts of 500 missing gold coins.

The real story here is that civil contempt can net you an indefinite prison sentence without a conviction, and if you're lucky a judge will decide to let you out. Over something you may or may not even know.
How else could it possibly work? The justice system depends on judges being able to compel action. Within the guardrails established by the system (e.g. no self-incriminating testimony, if you’re in the US), I don’t have a problem with refusal to e.g. turn over evidence just resulting in detention until you comply. It’s not a prison sentence, since you can get out any time you want.
You ask how else could it possibly work. How about charge him with a crime first, then detain him if he's convicted. The idea that you can imprison someone forever without a charge is insane.
You can't resolve criminal liability without compliance to judicial authority. It's not even a meaningful demand. If you don't trust the judiciary you can't trust any other component of the system!

Then you can charge him with the crime of contempt, and allow that charge to be proven or disproven through actual due process.

There is no such thing as a valid reason to skip the part where you have to prove guilt. Even for a judge. Frankly especially for a judge. Everyone else has the excuse that they aren't lawyers. What's a judges excuse?

You can't prove or disprove anything with someone who refuses to comply with the courts. This is due process.