It really comes down to a matter of preference, but most homeowners typically repaint the majority of their homes every 7-15 years.
Today’s paints are designed to last a lifetime, so it should be many years, if not decades, before paint starts to peel. Cracking may occur as the house settles, but that is usually due to the structure shifting and not a poor paint job. If the paint was not applied properly (e.g., surface not prepared correctly), it may peel earlier, or this may indicate another major problem such as moisture in the walls.
You should likely re-paint when the house is looking dated, the walls are scuffed up or damaged beyond cleaning, or when you’re just plain tired of the color. Between 7 and 15 years is a reasonable expectation of time between re-painting.
The keys to a long-lasting paint job are good surface preparation and high quality paint. If you don’t wish to re-paint for quite some time, keep in mind that there are colors that seem to always be current (mainly “neutral” colors) and others that while may be trendy today, a decade from now someone will look at them and say “wow that is so 2010’s.”
Many people paint neutral colors before selling a home as it does look new, and some potential buyers can be negatively affected by strong colors they don’t like or that make a room look dark or small.