Dominique's marriage to Peter Keating is one of deliberate self-torture. She has been shown by the public time and time again that they will reject Roark, her ideal man, and embrace Keating, a man she views as the worst society can offer. In marrying him, she is making a conscious effort to reject her own ideals and live subordinately in the world that she is given by collective opinion. Earlier, she rejects Keating outright:
"Peter, if I ever wanted to punish myself for something terrible, if I ever want to punish myself disgustingly -- I'll marry you."
(Rand, The Fountainhead, Google Books)
Dominique has a history of punishing herself through her reactions to art and literature; at one point, she purchases a statue that she finds beautiful and destroys it so it won't be tainted by the world around it. After meeting and sleeping with Roark, she believes that there is a chance the world could accept him, but after the public rejects his church -- a church that implicitly worships Man instead of God, and features a statue of Dominique nude -- she suffers a deep personal setback. Her marriage to Keating is a personal response: "If society wants me to accept mediocrity, I will accept the most mediocre person I can find." Keating does not understand, and marries her for the social status it affords him.