It turns out that facial recognition (and probably all forms of recognition) are partly contextual. That is, you recognize things more readily when they’re in their proper context.
When I was in high school I worked at a grocery store, and I would frequently see people who I knew I recognized, but couldn’t figure out why. They were almost all people from my school who I had never seen outside of school before. My brain had associated them with school, and out of context it couldn’t quite process them right.
This is probably related to the fact that memory has a contextual basis, and sensory input that you experienced during the “recording” of a memory can often cause you to remember it. Smells are particularly powerful at bringing back memories, although images (think about the attachment to photographs and family albums), sounds (music especially), even tactile sensations can all do it. This powerful association between memory and context is probably the cause of contextual recognition.
There might be an evolutionary reason, though. Perhaps recognizing an object, animal, or person based on your surroundings helps to filter information (like thinking someone/thing is someone/thing that it isn’t). It could also speeds up recognition by providing additional criteria to narrow the search. I find neither of these convincing, and can’t come up with any other benefits.
Whatever the reason, this effect is real. Now you’ll notice it all the time, too. Glad I could be of service.