I believe the answer lies in the description of the Trapped card (which is used to lock someone up). This comes from the official rules of Saboteur2:
Play this card face-up in front of another player of your choice. This
player is trapped and cannot play any more path cards. If a player is
trapped when the round ends, they don‘t get counted as one of the
winners and don‘t get a cut of the treasure
The Trapped card does not specify this status only applying to certain roles. So if a Geologist is trapped, that player would not get their gold.
I also found a post on a BGG forum for Saboteur 2 from Frederic Moyersoen, the game designer who states that a Trapped Geologist gets no treasure.