When going for a new job you want to set yourself aside from all of the other applicants and be memorable. Setting yourself apart from the rest of the applicants gives you a better chance of getting the job.
Jobs are no longer permanent and if you leave too early or too late, you can put yourself at a disadvantage. If you stay too long, your knowledge may become stale, whereas if you leave too quickly, you may look like a job hopper. It’s also possible to leave a job where the problems can be fixed or to stay at one where they cannot.