The actor, who shared the story on Jimmy Kimmel Live! Tuesday, said the incident happened while he was getting his hair cut that morning.
"I found out today that I have nude pictures on my phone," the 28-year-old told host Jimmy Kimmel.
Hammer said he was talking about his 8-month-old daughter, Harper, with the stylist when he decided to show her some photos of the baby on his phone.
"I'm going through my phone and I get to pictures where she's lounging in the sink and she looks like she's having the time of her life," Hammer said. "I'm showing her these pictures and I'm like, 'Look at how cute she is! We're in the bathroom. She's just right in the bathtub.'"
It was only a few seconds later that the star realized what was in the background of the images.
"I realize that I'm standing fully nude in the mirror of this bathroom as I'm showing her these pictures," he said. "As quickly and casually as possible, I went, 'Anyway, you get the picture!' "
Hammer told Kimmel he didn't think the stylist "noticed anything," but he was still embarrassed.
RELATED VIDEO: Why Are Matthew McConaughey and Jimmy Kimmel Trying to Break the Internet?
The actor was on Kimmel to promote his new movie, The Man From U.N.C.L.E., in which he plays KGB agent Illya Kuryakin.
The Cold War spy thriller hits theaters Aug. 14.