The story
From the practice of mending a small tear in cloth when first noticed ("in time"), before it becomes a larger one requiring more stitches.
Etymology from Wiktionary, CC BY-SA 4.0.
Today it means: A little effort expended sooner to fix a small problem prevents it from becoming a larger problem requiring more effort to fix later. Full definition →
From the practice of mending a small tear in cloth when first noticed ("in time"), before it becomes a larger one requiring more stitches.
Etymology from Wiktionary, CC BY-SA 4.0.