Shaffer was born to a Jewish family in Liverpool, the son of Reka (born Fredman) and Jack Shaffer, who was an estate agent. He was the twin brother of writer and dramatist Peter Shaffer. He graduated with a law degree from Trinity College, Cambridge.
Shaffer's most notable work was Sleuth (1970), which he adapted for the film version of the same name, and starred Laurence Olivier and Michael Caine. He received Edgar Awards from the Mystery Writers of America for both versions: for Best Play in 1971, and Best Screenplay in 1973. His other major screenplays include the Hitchcock thriller Frenzy (1972) and the British cult thriller The Wicker Man (1973) with whose director, Robin Hardy, Shaffer had previously set up a television production company in the United States, Hardy, Shaffer & Associates. A major theme in Shaffer's work is the playing of psychological games between people. His two best known works - Sleuth and The Wicker Man - both revolve around this idea.