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.