Can a witness be compelled to testify? The Torah says you must testify [Lev. 5:1] but the Talmud says punishment for not doing so can only come from God [Bava Kamma 55b]. You may not want to testify because you don't want to lose valuable work time, or because you are afraid of the consequences (threats of harm, ostracism from litigant or community, loss of livelihood etc.), or simply because you don't want your past probed and your private life dragged in the open for cross-examination, etc. In civil law, you can be subpoenaed (summoned to court) to testify in court and jailed if you refuse. But what about in halacha?
The only way to be sure Lehalacha that a man is withholding testimony is if 2 Eidim (witnesses) were to witness that this person (or these 2 people) saw the occurrence, and they can only be sure he saw the occurrence by seeing the occurrence themselves at the same time. So there would be no point compelling the "withholder" to testify, as those witnesses could just give Eidus (testimony) themselves, we only need as תרי כמאה- eidus of 2 people is the same as 100 people (Shavuos 42a).
If their are no eidim that saw the "withholder" see the occurrence, we cannot force him to testify as there is no halachic proof he was there, the litigant is biased and we don't trust his word. However the litigant can Mashbia (force the "withholder" to swear) a "witness' oath" - שבועת העדות on the "withholder" (as the questioner correctly quotes from Vayikra 5) that he saw nothing, and we have no choice but to believe him. If he lied under oath and later admits, he would bring a korban oleh veyored. (Shavuos 30a). If he swears falsely does not admit see Gittin 35a that False Oaths causes ones children to die. But we believe him as he is innocent until proven guilty.
While not a direct proof, there is perhaps some roundabout evidence from the Talmud in Pesachim 12b. The Talmud there had been discussing at length the possibility of witnesses mistaking the times that they are testifying about. According to various suggestions for what level of mistakes we would be concerned about (e.g. being off by an hour) the Talmud asks why the rules for eating chametz on on the day before Passover do not follow the same assumptions (that people will only mistake the time of day to the same degree as in testimony). The Talmud answers:
אמר אביי עדות מסורה לזריזים חמץ לכל מסור
Said Abaye: Testimony is committed to careful men, [whereas] leaven is committed to all.
Rashi there explains:
אין אדם בא להעיד על הנפש אא"כ בקי בשעות לפי שיודע הוא שסופו להדרש בדרישה וחקירה אבל חמץ על הכל מוטל ושאינו בקי בשעות טועה בהן
A person does not come to testify on [matters of] life unless he is expert in hours, because he knows that he will end up being cross-examined. But chametz is incumbent on everyone, and one who is not an expert in hours will make a mistake with them.
Now if testimony could be compelled, then how would we know that only experts are testifying? Perhaps the compelled witness was not an expert? If, however, testimony could not be compelled then the assumption that the witness is an expert would hold up.