When Garp attacked the Hachinosu pirate island to save Koby, he was confronted by several captains of the Blackbeard Pirates. One of the surprising moments was Garp being stabbed by Shiryu, who was actually targeting Koby and Garp was protecting his student.
So why was Shiryu able to stab Garp?
1. Shiryu has the Suke Suke no Mi devil fruit ability and tries to quickly attack Koby with Sword Haki
One scene in the anime shows Shiryu using Armament Chroma Haki on his sword while trying to stab Koby. In addition, Shiryu also used the ability of the Suke Suke no Mi devil fruit to become invisible and tried to attack Koby quickly.
The specific situation was, Shiryu's sword was imbued with Armament Haki while he tried to attack Koby quickly using stealth.
2. Maybe Garp hasn't had time to use Armament Haki to protect his own body
Once again, Shiryu's attack was very fast, Garp had to act quickly to protect Koby and push his student away, then make a human shield himself.
Garp was stabbed by Shiryu's sword, perhaps your question is why didn't Garp use Armament Haki on his stomach to protect himself? Maybe because the incident happened so quickly, Garp didn't have enough time to use Armament Haki at the time Shiryu stabbed him.
3. Or maybe Garp used Haki, but it wasn't perfect so it was overwhelmed by Shiryu's Haki
Perhaps when Garp saw Shiryu preparing to stab Koby, the navy vice admiral was ready to protect the “pink panther” youth. That short moment Garp may have also used Armament Haki, but because it happened so fast, Garp's Haki was not as strong as the Haki on Shiryu's sword that he had prepared. As a result, Luffy's grandfather was still stabbed.