The length of a background actor's employment on a production largely depends on the needs of the director and the scenes being filmed. Some background actors are needed on the set only for a day or two, while others may remain with the film for an extended period.
For instance, on James Cameron's film Titanic, a group of 150 "core background actors" was hired to play the ship's passengers, and employed throughout the filming.