i think it comes from in the war (sorry i know thats not really precise, i dont know which war!!) it was said that you should not strike 3 matches (for cigarettes) in a row because 3 matches gave the enermy chance to see exactly where you are.
pink, you could be right, I seem to remember something about not taking the third light of a match during the war as this gave the enemy the opportunity to ready, aim then fire.
The wartime thing did not refer to three separate strikes...ie three different matches...it referred to keeping one match alight for sufficiently long to enable an enemy sniper to pinpoint troops' position. Thus the third one to take a light from it was the target.
The 'three strikes and you're out' idea was taken from baseball, as Ummmm said above and refers specifically to some States in the USA introducing laws which stated if you committed three separate crimes you would be banged up for ages, even life. In one case, this resulted in someone being imprisoned for life after just stealing a sandwich from a kid!
I meant to add above that Warpig was right in her explanation of the situation of the 'third light', though not really in the case of suggesting Pink might be right in hers.
I see from your green name-colour, Pink 85, that you are a new member. Accordingly, let me advise you that - since this is a question and answer website and questioners generally want correct answers - you have to expect wrong answers to be corrected.
Someone who corrects you is not being rude if he/she simply says you are wrong.
in baseball a strike is a fair pitch which the batter swings at. (A 'ball', as I recall, is an unfair pitch - too high or low; the batter doesn't have to try to hit those, like a 'no ball' in cricket.) If you miss three in a row you're out. The term has broadened out into the wider language, chiefly in America, to suggest you only have three chances to do something, and has been specifically used as QM says by lawmakers imposing very strict criminal laws.