Let’s back up and get more of that verse. In full, it reads, “A person who sins because he is called upon to testify as a witness because he saw something or he knew something, if he does not testify, he will bear his guilt.”
A person had to testify in a civil case if called upon by Beis Din; in a capital case, a person had to come forward even if not summoned. The basis of this mitzvah is to maintain a just society. We have to right financial injustices and, even more so, remove dangerous criminals from our midst.
While one could not serve as a judge on the case of a friend or an enemy (from fear of bias), all who have information are called upon to testify, regardless of their relationships with the litigants. Once given, testimony could not be retracted.
Okay, the elephant in the room: only men serve as witnesses in halacha. This is not, however, because women are untrustworthy. Every man relies upon his wife when it comes to the kashrus of the kitchen and in matters of family purity (which carries a penalty of kareis if violated). Clearly, we rely upon a woman’s word and her expertise in such important matters. If we didn’t, no man could eat in his own home! There are others who don’t give testimony, as described in the Talmud (Kiddushin 40b, Sanhedrin 26b, et al.). The Kohein Gadol (High Priest) only testified to the king; the king of Israel didn’t testify at all! There are those who speculate that women are excluded because their natures are more compassionate than men’s, but let’s chalk this up to the fact that some mitzvos apply to some people and not to others.
This mitzvah applies to men in all times and places. It is discussed in Talmud in the second chapter of tractate of Sanhedrin, and elsewhere. It is codified in the Mishneh Torah in the first chapter of Hilchos Eidus. It is #178 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos. The Chofetz Chaim does not include this mitzvah in his Sefer HaMitzvos HaKatzar.