It is from Casablanca. It is one of the more wrongly quoted and wrongly attributed line from cinematic history. No one in the film says "Play it again, Sam".
The phrase "Play it, Sam" is actually said by Ilsa Lund (Ingrid Bergman). Later in the film, Rick Blaine (Humphrey Bogart) tells Sam to "Play it!"