As often as necessary. Depending on the child and the rule, once may be enough. Other times it may take many, many constant reminders. There is no magic one-size-fits-all number.
For example, if you know or suspect your child will have problems remembering not to talk to strangers, remind them when you are about to go somewhere where they might have to deal with strangers. If you can ask the child what to do when they encounter a stranger and they can remember on their own, they may not need to be reminded any more. Also, reminding them when they are likely to need that information will help them to better remember it.
Age is only a small factor in how much you may need to remind a child. Small children typically need more repetition to remember some things but this isn't always the case. Some small kids get it on the first or second try. Some older kids need to be reminded a lot before they remember. And any kid is subject to forgetting something when they are caught up in the moment.