The Mitzvah to testify in Beis Din and the prohibition against giving or publicizing testimony that cannot be corroborated in court:
It is a [Biblical] command for one who witnessed a certain matter that can be of benefit to another person in Beis Din, for him to testify on this matter on his behalf. This applies both regarding testimony that can serve monetary benefit for another, or testimony of a sinful matter or activity of which its information is necessary to prevent others from transgressing, or testimony that can prevent harm from befalling another.
If the testimony is uncorroborated or invalid: The above obligation to testify only applies if the testimony of the witness meets the standards of corroboration held according to Jewish law, and his testimony is thus acceptable. If, however, his testimony is Halachically viewed as uncorroborated or invalid, and thus cannot be accepted in court regarding any matter of the judgment, then not only is he not obligated to testify, but at times it is even a prohibited to do so. Thus, for example, if a single witness saw an individual commit a sin [such as a sexual sin] it is forbidden for him to testify of what he witnessed, and one who does so is considered to be spreading libel [and transgresses the prohibition of Motzi Sheim Rah, or/and the prohibition of “Lo Samod Eid Echad”]. On this we apply the Talmudic aphorism “Tuvya Chata Vezigud Minaged.” [The Talmud states that it once occurred that an individual named Zigud testified of a sexual sin he saw performed by a person named Tuvya. Zigud testified of what he witnessed before Rav Papa. Rav Papa subsequently ordered Zigud to be lashed. A perplexed Zigud questioned “Tuvya sins and Zigud gets lashed?” Rav Papa replied that the testimony of a single witness is considered Halachically uncorroborated and dismissed in court. Thus, the Torah instructs us not to believe this witness at all. Accordingly, it ends up that Zigud himself has transgressed the prohibition of spreading slander, and he was thus lashed.] This, however, only applies if the sin is not a recurring event, and thus the witness is testifying of something relevant to the past. If, however, the sin is a recurring event and his testimony can be used to deter the perpetrator or others from transgressing, then he may testify to the Beis Din.
What is considered uncorroborated or invalid testimony? Coming up in part 2!
Accepting Halachically uncorroborated/invalid testimony in a time of public need: Coming up in part 2!
Publicizing the matter to others: Coming up in part 2!
 Michaber C.M. 28:1; Bava Kama 56a; Chinuch Mitzvah 122
Does this obligation apply even if the person was not summoned to testify by the court, or any of the sides? Some Poskim rule that one is only obligated to give testimony if he was summoned to testify, otherwise he does not transgress anything. [Michaber ibid; Smeh 28:6] Other Poskim, however, rule one is obligated to offer his testimony even if he was not summoned by the court or any of the sides, due to the command of Lo Samod Al Dam Reiacha and the Mitzvah of Hashavas Aveida. [Mishkanos Yaakov 12; Shaar Mishpat; Pischeiy Teshuvah 28:4; Aruch Hashulchan 28:3] See Chinuch ibid who differentiates between monetary cases, in which one is only obligated to testify upon being summoned, and cases of other Issurim, such as he [and another witness] saw another transgress, or Dinei Nefashos, that he must testify on his own.
 Rama 28:1 “Oa Bedavar Issur Lefrusheiy Meissura”; Chinuch ibid records the obligation applies likewise to testify regarding other Isusrim; Aruch Hashulchan 28:1
 Pashut, as this is included in Lo Samod Al Dam Reiacha
 Michaber 28:1 that one is only obligated to testify if “one is a valid witness [not a Rasha or relative-Smeh 28:3] and his testimony serves a benefit.”;
 Rama ibid regarding if the Issur was already done
 Pesachim 113b
 Implication of Rama ibid; Pesachim 113b; Rashbash 511
 Smag L.S. 213; See Pesachim ibid
 Rama ibid; Hagahos Maimanis Eidus; Pesachim 113b; Makos 11a
 Smeh 28:12; Pesachim 113b; Makos 11a and Rashi there
 Pesachim 113b
 Rashbam ibid; Aruch Hashulchan 28:1
 Rama ibid