This phrase is often used to express the idea that not every attempt at something will be successful. It is a reminder that failure is a part of life and that it is important to accept it and move on. It can also be used to encourage someone to keep trying despite a setback.
From Wikipedia
You Can't Win 'Em All is a 1970 British-American war film, written by Leo Gordon and directed by Peter Collinson. It stars Tony Curtis, Charles Bronson and Michèle Mercier. The film is set at the end of the Greco-Turkish War (1919–1922). Two American mercenaries are forced to serve an Ottoman governor, who wants them to escort his daughters to Cairo. He also wants them to safeguard a treasure.