Also happens in a Neon Genesis Evangelion fanfic ("Father") where someone takes advantage of a drunk Asuka during a house party and she gets pregnant. Shinji instantly proposes to her. This, of course, is not something Asuka's father would tolerate and he attempts to force Asuka at gunpoint to cancel the engagement and have an abortion before returning to Germany for an Arranged Marriage. The emphasis is on 'attempts' as Shinji, Misato and Gendoall gang up on him. Special mention goes to Gendo being a Papa Wolf to Asuka.
Another fanfic "Acts of Kindness" has Asuka finding out that Shinji is now engaged with one of their classmates because they had an affair and he accidentally got her pregnant. That's actually a cover story; what really happened is that the girl got raped by her own father and got pregnant from it. Since the bastard was a Nerv employee, Gendo quickly has him disposed of by Section 2 and Shinji volunteers to provide the cover story. Of course, the girl then has a Convenient Miscarriage and she moves out of the city, knowing that Shinji and Asuka love each other but Cannot Spit It Out.
Film - Animated
Strongly implied in, of all things,Lady and the Tramp. After Tramp spends the night alone with Lady, Jock and Trusty discuss proposing to her to protect her honor.
This is relatively given since she has puppies in the end.
In "People Will Talk", Cary Grant's doctor/professor character meets Jeanne Crain's coed character, gives her the "yes, you are pregnant" news, sends her off to tell the husband he assumes she has, and discovers subsequent to her near-immediate failed suicide that she's unwed. Naturally, he does what any ethical medical professional would do given the circumstances: apologize for the "misdiagnosis", court and marry her lickety-split, and be overjoyed at her becoming pregnant very soon after - as far as she knows - the wedding. Values Dissonance, anyone?
Sam Clay proposes to Rosa Saks for this reason in The Amazing Adventures of Kavalier and Clay. She's pregnant with his cousin Joe's child, Joe has gone off to war and probably isn't coming back, and he's gay and heartbroken as he's just split up with his lover.
In Emile Zola's book La Curee (The Kill), Aristide Saccard uses this ploy to marry a rich girl.
In the novel The Lady and the Unicorn, by Tracy Chevalier (author of Girl with a Pearl Earring), set in the late Middle Ages, Philip marries Aleinor after she gets pregnant from another guy, to help her escape from an Arranged Marriage to yet another man.
In My Year of Meats, by Ruth L. Ozeki, when Jane finds out her ex got her pregnant, one of her coworkers offers to marry her. Naturally, the fact they're also quite good friends isn't enough to make her accept.
In The Masterharper of Pern, which explains Masterharper Robinton's backstory, it's revealed that the simple-minded workman of Harper Hall, Camo, is actually Robinton's son by the headwoman Silvina. When Silvina tells Robinton that she's pregnant, he offers her marriage. She refuses because she knows he's still in love with Kasia, his dead wife.
In The Governess Affair by Courtney Milan, Hugo is hired to prevent a duke's ex-governess from causing a scandal. However, he learns that the duke had raped her, after which she was fired for not being a virgin (and thus too immoral to raise children), after which Serena realized she was pregnant with the duke's child. The threatened scandal is Serena's desperate attempt at child support. Hugo marries her himself and claims the child as his own, giving Serena and her child both respectability and financial support.
In Salman Rushdie's Midnight's Children, Saleem reluctantly proposes to Parvati the Witch to save her honor after she gets pregnant with his archrival's son—whom she had an affair with on purpose in order to get Saleem to marry her. To be fair, he probably would have married her on his own if not for certain... issues he haswith his sister.
In The First Law, Glokta marries Ardee to save her life and that of her unborn child; she's the mistress (and carrying the bastard) of the new king, and it's the only way for him to get out of killing her to protect the throne.
A variant in Bluestar's Prophecy, the eponymous character has a forbidden inter-Clan relationship with Oakheart, and ends up having his children. Thrushpelt - despite also having feelings for Bluestar - offers to help her care for the kits and let their Clanmates assume that Thrushpelt was the father, which Bluestar accepts. note There's a Clan rule which states that pregnant she-cats do not have to tell anyone who sired their kits, but doing so would have led to a lot of awkward/dangerous questions- inter-Clan relationships are often punished with exile.
In Laverne and Shirley, when Laverne thinks she might be pregnant (a few days after a drinking contest at a party where she can only remember bits and pieces), Lenny comes down to talk to Laverne.
Lenny: So, me and Squiggy flipped a coin to see which one of us was gonna volunteer to be your husband.
Laverne: Awwww, and you lost, huh?
Lenny: No, I won.
He then adds how he's going to go out for an exam to get a better job and adds:
Lenny: I'm gonna make a good living. Plus, I'll practically never hit you or nothin'...
In Deadwood, Ellsworth to Alma Garret, as she's bearing the child of a guy who's only (lovelessly) wed for the similarly-honorable reason of dutifully marrying the widow of his dead brother.
Studio 60 on the Sunset Strip: Danny proposes to Jordan while she's giving birth. He first asked her out shortly after discovering she was pregnant, and she was initially worried that this trope was the sole reason for it.
In A Woman Of Substance, Blackie tells Emma to list him as the father of her child on the birth certificate when she refuses to name the real father, so the child will not have the shame of having the father listed as unknown.
Friends: Joey proposed to Phoebe when everyone thought that she was the one that was pregnant (not to "preserve her honour", but because it's tough to be a single mother). Once they find out it's really Rachel, he promptly asks the ring back from Phoebe so he could propose to Rachel. Made funnier by the fact that Phoebe gleefully accepted Joey's proposal, then seems upset when Joey says he needs the ring back.
In The Secret Life of the American Teenager, Ben, convinced that he is in love, proposes to Amy shortly after finding out she's pregnant with Ricky's baby. Since they're 15 and have only been dating a few weeks at that point, their parents don't approve. In fact, no one thinks that Amy needs to be married just because she's pregnant. None of these things stop Amy and Ben from secretly getting married. But since it's with fake IDs, the marriage is invalid and they end up breaking up later anyway.
Of course, it's really just Niles finding a way to express his love for Daphne via loophole. Once he finds out it's ROZ who's pregnant, his desire to 'do the right thing' evaporates.
In How I Met Your Mother, after Robin sarcastically says she's pregnant after Ted asks why she was throwing up, he's down on one knee immediately, swearing that he'll marry her and help her raise the kid — though he quickly stipulates that it'll have to be "one of those marriages", where they date other people (this was long after Ted and Robin broke up). Later, the exchange is repeated between Robin and Barney, whose reaction is instead to bolt from the room in a panic at the thought of this trope.
In the newspaper comic, 9 Chickweed Lane, Gran/Edna says this is the reason she and Bill ultimately got married: He was "protecting her honor" after they discovered she was pregnant by the man she left to be with Bill.
The story of the Nativity is not strictly related, but Joseph hesitated to wed Mary because she was pregnant and he knew darn well it wasn't his. Not wanting to humiliate her, he planned to quietly cancel their engagement. An angel from Heaven had to step in and tell him everything was okay.
King David tried to pass his marriage to Bathsheba off as one of these (or even as just a regular marriage), but he actually was trying to cover up the fact that he got her pregnant even though she was already married...and killed her husband to facilitate the cover-up.
In The Book Of Genesis, Dinah is raped by Shechem, who then wants to marry her; instead, her brothers Levi and Simeon kill him and raze his town. According to some Jewish accounts, Dinah was pregnant from the rape and was angry at her brothers, since she didn't think she could ever find another husband after the incident. She then forces Simeon to take her into his home like a wife and raise her child, though the two never actually consummate the arrangement.
Grover Cleveland did something roughly similar in real life. He didn't marry the mother, but did support the child, even though he was only one of the possible fathers. His political opponents tried to use the scandal against him, but the fact that he owned up to the situation and took responsibility despite no one being sure he was the actual father made him look better in the long run.
Opposing Political Slogan: "Ma! Ma! Where's my pa?"