Fathers shall not be put to death because of sons and sons shall not be put to death because of fathers… (Deuteronomy 24:16)
Close relatives are not permitted to testify as witnesses in a person’s trial, whether it is regarding a civil matter or a criminal one. Even in a capital case, where one’s testimony might cause a murderer or an idolator to be executed, the relative is not accepted as a witness. (Hence, “fathers shall not be put to death because of sons, nor shall sons be put to death because of fathers.”)
This mitzvah doesn’t only apply to fathers and sons, but the Torah does apply it only to relatives on one’s father’s side. It includes grandfathers and grandsons, brothers from the same father, nephews who are the sons of those brothers and the reciprocal uncles. By rabbinic enactment, we do not accept testimony from analogous relatives on the mother’s side. (Some authorities say that even those relatives on the mother’s side are in fact excluded by Torah law.) Also, if you can’t testify about a particular person, you also can’t testify about that person’s spouse.
The reason for this mitzvah is that justice relies on the testimony of witnesses. Once you bring relatives into the picture, objectivity goes out the window. Even if the witness wouldn’t lie on the stand, their perceptions of what they saw are nevertheless colored by their relationship with the defendant. Accordingly, no testimony is accepted from close relatives, neither for the prosecution nor the defense.
This mitzvah applies to men in all times and places. It is discussed in the Talmud in tractate Baba Basra (128a) and in Sanhedrin (27b-29a). It is codified in the Shulchan Aruch in Choshen Mishpat 33. This mitzvah is #287 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #74 of the 194 negative mitzvos that can be observed today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.