Meaning: it is a way of saying that if somebody says something about you that you don't agree with them you should accept the criticism
Example: The teacher said that the boy's work was too messy but he tried to argue with her about it. She said, if the shoe fits...
See this Idiom in a story: The Most Unruly Class in the World