Edit: the question wasn't worded as well as it could be. I should clarify that I'm aware sham marriages are illegal. For the purposes of this question, let's assume law enforcement doesn't realize or can't prove it's a sham.
Note: I was in here a month or two ago asking about a similar topic, but to re-iterate, I'm a writer trying to do some research and figure out logistics for a story I'm working on, so this all may sound crazy.
Say we have two characters, John and Lisa, and they work together. Lisa does something illegal, and John was a witness. John's testimony is really the only thing law enforcement has to go on at this point, but circumstances are such that both characters could suffer if John testified (maybe he was also doing something questionably legal that his testimony would bring to light). If the characters hear rumors that the police will ask John to testify, but he hasn't officially been asked yet, can he marry Lisa, invoke spousal privilege, and avoid being compelled to testify? Or would that not count since the event he would have been testifying about occurred before the marriage?
Side note: John and Lisa are in love so marriage in general wouldn't come as any huge surprise to anyone who knows them, but the suddenness might seem odd.
This is a really simplified version of the whole scenario, but I'm hoping it'll still be enough to help me figure out whether the idea I have in mind would even be reasonable. Granted, this story is set in a fictional universe so I have some room to maneuver, but many of their other laws have Earth/real-life origins so I'm trying to at least base the general ideas on real things.