Okay, look, it's not that she 'can't' leave in a physical sense—the doors aren't locked. The real trap is a mix of debt, reputation, and that weird, creeping obligation the aristocracy is so good at manufacturing. Her family basically sold her into this marriage to settle their own financial ruins, so if she bolts, they're utterly ruined. The Duke's family also holds some kind of leverage, maybe documents about her father's past failures or something. It's less a cage and more a web; every time she thinks about running, another strand sticks to her.
Then there's the psychological stuff. Where does a gently-bred lady with no money and a scandalous divorce go in that society? Nowhere good. The story spends a lot of time on the slow erosion of her spirit. She starts out defiant, but the constant gaslighting and isolation in that huge, cold mansion make her doubt her own reality. Leaving starts to feel impossible because they've convinced her she has nowhere to go and that the problem is her own instability.
Honestly, I found it the most frustrating part of the book—I kept yelling at the pages for her to just go to the stables, take a horse, and ride. But the mechanics of the entrapment are sadly pretty historically accurate for women in those positions.