This problem very often starts during adolescence. The medical expression for this type of anxiety is "paruresis" or "bashful bladder syndrome" (BSS). Some people will not think of an anxiety disorder but more or less claim organic reasons for their problem to urinate in public toilets.
As a consequence of their anxiety or discomfort these persons try to avoid any public situation like going to restaurants, sports or even a walk in the town. So they get isolated and try to stay at home whenever possible. Severe forms of this social phobia will have a big influence on work and family life and cause secondary depression or substance abuse.