Back in the day, women often were not permitted to have their own money and/or property, and therefore a woman who chose to divorce an adulterous spouse would be at risk if the former husband predeceased her. He'd be required to pay alimony during his life but if he remarried then the new wife would inherit upon his death. I suspect the "no remarriage for adulterers without permission from the court" statutes were intended to address that, and I imagine the court might well condition such permission of the drafting of a will to protect the former wife.
But yes, ineffectual and conducive to uncertainty for sure, if such a prohibition could be avoided simply by leaving the state.
Fascinating. They certainly never taught us about that in law school. I'll have to ask my husband if he's ever heard of such a thing.