One must do what is necessary to achieve your aims, whatever the consequences.
According to America's Popular Proverbs and Sayings edited by Gregory Titelman (1996), this not particularly profound expression is attributed to a line spoken by John Wayne in the 1939 western Stagecoach. But in John Steinbeck's The Grapes of Wrath (1939) Jim Casey expresses a very similar thought:
Casey said quickly, "I know this - a man got to do what he got to do. I can't tell you. I don't think they's luck or bad luck. On'y one thing in this worl' I'm sure of, an' that's I'm sure nobody got a right to mess with a fella's life. He got to do it all hisself. Help him, maybe, but not tell him what to do."