This expression means don’t judge a gift someone gives you.
The expression came from when people gave horses as gifts. The gift horse was usually old, and you can tell a horses age by looking at its teeth a horses age can be determined by its teeth. So if someone was given a horse they could figure out it age and value by looking in its mouth. You should be grateful for a gift and not try to figure out its value. So it would be rude to look a gift horse in the mouth because it would appear that you are judging it by the value of the gift.
By looking a horse in the mouth, you can tell their age and whether or not they are in good health. But if you get a horse as a gift, you should be happy to have a horse and not question what shape they’re in.
Happy Holidays- Justin The Artistic Horse