The hypotenuse is 13 cells long and 5 high.5/13 is an irreducible fraction. Therefore, the hypotenuse never crosses the grid's nodes except for its two ends. Thus, the trick is based on an optical deception: the defect is so little that you just don't see it. But it can be easily calculated.
EDIT: Note, that the hypotenuses on the two drawings are different. And neither is a straght