The story
Possibly from the practice of examining the length of horses’ teeth when estimating their ages: an old horse has long, rectangular incisors, and their occlusion angle is steep. Compare don't look a gift horse in the mouth.
Etymology from Wiktionary, CC BY-SA 4.0.