Wow! I think those people are wrong. I would NEVER leave my kid with some stranger so I could go to the bathroom!
IMO your husband did nothing wrong. Maybe if she were much older, but a 5-year-old shouldn't be left alone, not even for a second.
Likewise, the same argument for those who choose leave their kids in a running car to "pick something up, real quick." Alot can happen in those few minutes, such as kidnapping, car gears messed with and rolls away, heat exhaust and so on. No one leaves their kids with strangers then either. They take the kids with them.
Ignore this person. Your hubby did the right thing. I guess in the future, be sure to go to the bathroom before heading to the park, ice rink or whatever. I'd also use the family bathrooms versus the stalls if possible. Then you won't have people questioning whether she's seeing too much in a regular men's bathroom.