Federer is a five-time champion at the Wimbledon warmup tournament and was the No 1 seed, but said on Monday on his website that "my body, especially my groin, really needs a rest."
He says: "I feel that it's way too risky to take a chance on aggravating it even more before Wimbledon."
Federer lost to Rafael Nadal in the French Open final on Sunday.
Federer lost to Lleyton Hewitt in the 2010 Halle final and was due to play the Australian in the first round.
The Swiss' departure leaves Tomas Berdych of the Czech Republic as the highest-seeded player.
Tournament director Ralf Weber said Federer's withdrawal was "a personal disappointment that I cannot describe at the moment."
"I am stunned," Weber said. "Our plans for the past year have been nearly exclusively with Roger appearing. And he never gave us any doubts that he had health problems. I clearly expressed my disappointment to his management."