When is not actually a good question, because it is ambiguous. It could refer to either the child's age or a situation in which the swearing would be allowed.
To address both parts of the question:
Age: I believe a child below 10 years should be prohibited to swear at all. All swear words shoud be punished, however you see fit - but the child should have no doubts to what he is punished for. Later, gradually, I would lower the "threshold" for punishing: a cut finger, destroyed favourite toy, a loss in an important online match should be allowed a single "f***". The choice of allowed situations should suit parents. If you do not swear at all - then do not allow it at all.
Situations: I personally hate people who put swear words into every sentence. It is very common here in Poland, to use "fu**" practically as a comma. I can not stand that and I would focus my efforts to get rid of such behavior if my child developed such habit. However, I would be pretty comfortable with my 16 year old used a swear word if he broke a mug or hurt himself.
Gender: it may not be politically correct, but I think that women should swear less than men, preferably not swear at all. Whenever I hear a girl/woman swear, especially when it is unnecessary, it really grinds my gears.
Some more thoughts: I would never encourage swearing. If your kid does not catch the bad habit at school, don't ever introduce it.
To sum up - as always, try to use common sense. Choose your reaction based on all factors you deem important: age, sex, situation, present people, wherabouts, and so on. Try to be consistent with your punishments and their situations. Make sure you are comfortable with the type and amount of swearing your kid does. React if that threshold is exceeded.