A friend of mine has an idea for teaching youth about sex: have them view one of those graphic birthing videos that the hospital has for first-time parents, the kind that shows the crowning and the afterbirth, the agony and the joy. The kids will get the idea.

Knocked Up shows it all too. And like Judd Apatow’s previous smash hit The 40-Year-Old Virgin, the film winds through all manner of profane humor on the way to endorsing a surprisingly traditional vision of family. Baby-having is presented as a rigorous, life-altering and unabashedly good thing to do.

Katherine Heigl (Grey’s Anatomy) plays Alison Scott, an on-the-rise reporter for a celebrity-chasing cable channel. Beta-male star Seth Rogen plays Ben Stone, a pot-smoking slacker whose “job” is the construction of a Web site called “Flesh of the Stars,” which documents celebrity nude scenes. He collected $14,000 in damages when a postal truck hit him a decade ago. He has $900 left and figures he can live off that, with his fellow-stoner roommates, for another few years.

The two make an odd couple. But alcohol will do strange things. They hook up at a club, there’s some confusion about a condom, and soon she’s pregnant.

Her decision to keep the child is crucial to the plot, but is almost entirely unexplained. Is she religious? Is she afraid she’ll be too old to get pregnant later? Is she impressed with the flickering heartbeat on the ultrasound screen? Does it have something to do with his being Jewish? When Alison’s mother tries to dissuade her, saying, “One day you can have a real baby,” she speaks the only scene-concluding line that is not meant to be funny. Ben’s father, despite his own multiple marriages and stoner history, suggests that they should have the child, telling Ben that he is the best thing that ever happened to him. To which Ben replies, “Now I feel sorry for you.”

The accidental couple gamely make a go of it, though Ben won’t read the baby books. One of the most realistic lovemaking scenes ever filmed shows them working around her bulging belly. It’s not exactly romantic. They break up in the gynecologist’s office, but we sense how it will end: he’ll be helping her breathe in the delivery room, and his stoner friends will be helping him celebrate new life.

Apatow has a genius for identifying the pressure points of Gen-X and Gen-Y males. Ben and friends design homemade extreme sports and incessantly play video games. Offered a crib, Alison declines, but Ben accepts, wondering, “What else can I get out of this deal? XBox 360, XBox 360, XBox 360 . . .” He uses the language of movies to express his deepest feelings: “You’re telling me that if Doc Brown jumped out of his DeLorean we wouldn’t go back and get the condom right?” His buddy high-fives him for this reference to Back to the Future, while the women glare at these toddler-men, stupefied. To the question “Where are the young men who are not in church?” this film answers: they are slothfully hanging out in garages or basements, killing time with movies or video games, and occasionally having profound conversations or doing the right thing despite themselves.

Emotionally, 30-something males are a decade behind women of the same age. But with the right concoction of pressure and gentle goading, they can stand by the bed and ask questions about bloody show. It has been done.

The film includes an unusual number of references to cultural Judaism. Whereas Woody Allen’s Jewish jokes exude self-deprecation or self-loathing, these references exhibit love of friends, family and life. As the credits roll, baby pictures of cast members run by, and we see anew that child-bearing is the most nonsensical, self-denying and hopeful thing that humans do. Who knew that a filmmaker with a love of raunchiness could lovingly emphasize this theme? Perhaps Judaism, even the nonobservant and mostly cultural kind, is stubborn on this point.