Karen S has some really good ideas. I would lean in the direction that this is a psychological issue. And try out distracting him. Make it a rule that we only go to the bathroom every 30 minutes and then if that goes well increase the time between uses of the bathroom. Reassure him that you know he can wait but if he isn't that's OK. His mother could do a chart. A sticker for every time he is able to wait.
Add to this, finding ways to distract him so that he's not so aware of the time or how he's feeling. Does he go every 5 minutes while he's watching a movie or TV program?
I am guessing that the doctor is thinking that he might have an urge problem and that the medicine is to decrease the nerve activity in his bladder or something like that. There is no test for this disorder. If the medication works then that is probably what it is.
How much does he urinate each time? If none or very little it would seem to have something to do with the nerves that tell him it's time to go. I have had that after a UTI. It went away in a few days without medication.
Moving cross country could make him especially anxious and it may be coming out in feeling the need to pee. When I'm anxious I feel the urge to pee but when I go to the bathroom there is just a tiny bit but I don't get rid of the urge until my anxiety lessons. If he has in the past gotten into trouble because he wet his pants I would reassure him that an accident will not get him in trouble.
When you're out I'd just say, there is no bathroom here. I think that you can hold it until we get home or when we find one. Both of my grandchildren, ages nearly 4 and nearly 7 insist that they have to go right now. I tell them that they can wait until we get home. They will make a fuss, grab at themselves, squirm, etc. but when we get home they've frequently forgotten their desperation and wait 5 or 10 minutes before going. Sometimes when I remind them they say, "I don't need to go anymore."
What I'm suggesting is bladder training along with calm reassurance.
And to find out what the doctor was thinking when she prescribed the medicine and why the pharmacist said he wouldn't give it to a child.
You can find out more about the medicine on the Internet.
I just had another thought. Could this be his way of getting attention? If so I'd only pay attention when he's successfully waited. And I would rush to find a bathroom while they're out. And find ways to give him positive attention in other ways.