O'Keefe grew up in Larchmont, New York and attended the American Academy of Dramatic Arts and New York University, and made his acting debut in a 1970 Colgate television commercial.
O'Keefe is known for his role as Danny Noonan in the comedy film Caddyshack. He received a Best Supporting Actor Oscar nomination for his role as Ben, the oldest son of a Marine aviator in The Great Santini (1979), starring Robert Duvall, also nominated for an Academy Award for the film. He played a Marine in the CBS miniseries A Rumor of War (1980) as the friend of Brad Davis' character, Philip Caputo. He played the lead role in the 1982 film, Split Image, as a college athlete who gets lured into a religious cult by a beautiful girl (Karen Allen).
He appeared in the thriller film The Glass House, and starred with Tommy Lee Jones in the 1983 pirate adventure Nate and Hayes (also known as Savage Islands). More recently, O'Keefe appeared opposite George Clooney in Michael Clayton. He has appeared twice opposite Jack Nicholson, as his son in Ironweed and as the father of a murdered girl in The Pledge. His film Frozen River was in the competition at the Sundance Film Festival in 2008. He also plays the powerful District Attorney Calvin Beckett in the film American Violet.
O'Keefe was married to rock/blues singer Bonnie Raitt from April 27, 1991 to November 1999, when they announced plans to divorce. He has been a practicing Zen Buddhist since 1981.
O'Keefe's highest-profile television role to date has been his portrayal of Fred, the husband of Jackie Harris (Laurie Metcalf) on the ABC series Roseanne. O'Keefe appeared on the show from 1993 to 1995. After leaving the series, O'Keefe played the husband in the series Life's Work, which aired after Roseanne in its final season, in September 1996 to June 1997. Additional television credits include the lead role of Simon MacHeath in the short-lived Boston-based series Against the Law, which aired on Fox during the 1990–91 season and the role of Ron Steffey in the short-lived 1992 CBS drama Middle Ages.
O'Keefe's Broadway theatre credits include Side Man (1998), Mass Appeal (1981), Fifth of July (1980), and Reckless with Mary-Louise Parker (2004). He also appeared in the play A Few Good Men in 1992 with a national tour as Lt. Jg. Daniel Kaffee.
He married Actress Emily Donahoe in 2011, with whom he has one child.
He has guest starred on Saving Grace, The West Wing, Criminal Minds, Law & Order, Law & Order: Special Victims Unit, Law & Order: Criminal Intent, House, M*A*S*H, Ghost Whisperer, Brothers and Sisters, Leverage, "Blue Bloods" and The Waltons. In 2014 he appeared in a recurring role in Homeland as CIA agent and former interim station chief John Redmond and as Detective Winslow in the Amazon Prime original TV series Sneaky Pete.