As with toothpaste, the hCG in urine supposedly reacts with the vinegar, causing a change in color. there is no scientific basis and evidence that this is true.
No research suggests that they’re accurate methods for detecting pregnancy. They’re based on anecdotal evidence only.
Furthermore, there’s also anecdotal evidence that urine from nonpregnant people can cause the positive reactions described.