Garrity Rule
There is a "Garrity Rule". It is derived from Garrity v. New Jersey, 385 U.S. 493 (1967). In that case the US Supreme Court held that military and law-enforcement officers and other public employees are not required to sacrifice their right against self-incrimination in order to avoid dismissal.
Several police officers were accused of "ticket fixing" . They were interviewed, and although they were told they had a right not to incriminate themselves, were threatened with dismissal if they did not "cooperate".
The U.S. Supreme Court ruled that the employees’ statements, made under threat of termination, were compelled by the state in violation of the Fifth and Fourteenth Amendments. The decision asserted that:
... the option to lose their means of livelihood or pay the penalty of self-incrimination is the antithesis of free choice to speak or to remain silent.
The statements were held not to be admissible.
The US Supreme Court opinion can be found here.
Effect of the Rule
I find several sources (some listed below) indicating that public employees, including military personnel, may not be compelled, under threat of dismissal or serious discipline, to waive or refrain from invoking, their rights against self-incrimination.
If such employees are subject to such threats, any statements are considered compelled, and are not admissible against the makers of the statements, much as if a Miranda warning had not been given to a person questioned while under arrest. This does not make the statements inadmissible against a different defendant.
The procedures in courts-martial now require "Garrity Warnings", and do not attempt to force officers or enlisted persons to testify to self-recriminating facts.
I did not find any source suggesting that merely because testimony had been given in a court-martial, it is inadmissible. Nor did I find any source stating that merely being aware of inadmissible testimony renders a prosecutor or judge unable to continue. Judges hear inadmissible testimony every time there is a suppression hearing in which the evidence is in fact suppressed, and that is very frequent. It is only juries who must not hear such testimony.
Io invoke the rule, there would need to be evidence that a witness had been ordered not to invoke the 5th, or threatened with dismissal or other serious consequence if s/he did so, and would have invoked it in the absence of such orders or threats. In the original Garrity case, the defendants objected at the trial and at other appropriate times. It was those objections which triggered the ruling.
Conclusion
In short it seems to me that the writers of the show significantly overstated the breadth and effect of the rule, perhaps for dramatic purposes.
Sources
In the October 2018 issue of "The Adcisor" a publication of the US Navy's Judge Advocate General's office, it is stated thst the following warning must be given to any civilian employees who are being interviewed as part of a military investigation of a crime:
Garrity Warnings
You are being asked to provide information as part of an internal and/or administrative investigation. This is a voluntary interview and you do not have to answer questions if your answers would tend to implicate you in a crime. No disciplinary action will be taken against you solely for refusing to answer questions. However, the evidentiary value of
your silence may be considered in administrative proceedings as part of the facts surrounding your case. Any statement you do choose to provide may be used as evidence in criminal and/or administrative proceedings.
in Garrity Rights for Law-Enforcement Officers by By Aaron Nisenson it is stated that:
The basic premise of the Garrity protection is
straightforward: First, an Officer cannot be compelled, by the threat of serious discipline, to make statements that may be used in a subsequent criminal proceeding; second, an Officer cannot be
terminated for refusing to waive his Fifth Amendment right to remain silent. Gardner v. Broderick, 392
U.S. 273 (1968).
Therefore, if an Officer gives a coerced statement, the statement is "protected,” and cannot be used in a subsequent criminal prosecution.
However, the practical application of Garrity has been complicated and uncertain. The Courts have been
all over the map in their application of Garrity: with some Courts applying Garrity to protect Officers’ Constitutional rights, and other Courts seeming to try to evade Garrity. Thus, in the Garrity area, Officers are best served by following the old adage: prepare for the worst, and hope for the best.
The initial issue in the application of Garrity is the Department’s actions in extracting a statement from an Officer. In order for Garrity protection to apply, the government must have “coerced” a statement from an Officer. Generally, this coercion consists of an order, under threat of termination, to give a statement on a work related matter
The US Rules for Courts-Martal states in Rule 405. Preliminary hearing section (f) (2) (D) (on page 36) that an accused has the right to:
Be informed of the right against self-incrimination under Article 31.