Some things to consider:
• Will you learn more/less?
• Will you work with people you enjoy more/less?
• Will you enjoy the work you are doing more/less?
• Will you be respected more/less?
• Will your work-life balance be better/worse?
• Will your location be better/worse?
• Will your compensation package be better/worse?
[1] If you have a better opportunity at another company and your current employer genuinely cares about you they will either improve your position (to convince you to stay) or they will have no hard feelings when you leave (assuming you were respectful, considerate, and upfront about the situation).
Changing too often can be perceived as unloyal, but changing not often enough can be perceived as unable to adapt to new technology.
Hiring and training represent a major investment of time and energy (and sometimes money). If your job history shows you rarely stick around even for one year, a lot of companies will be wary because they get a much greater return on that investment from an employee who sticks around for at least a couple years. If you leave after 6-9 months, the ROI may even be negative.
This goes double for small startups, for which a month or two of resume reading and interviewing by the CTO, for instance, followed by a few weeks of training and onboarding and a few months in which the new hire is at <100% productivity while they get up to speed on the existing codebase and tooling/processes, can put a major dent in software development progress. (Note: we're talking about knowledge work here - the economics are a bit different for pizza delivery staff.)
That doesn't mean you should stay in a job that you quickly determine is a poor fit. A short stay or two on an otherwise solid resume isn't a big deal. It's just that a pattern of them signals high risk.
That said, staying somewhere (other than as a founder) for more than about 5 years is also a red flag for anyone who began their career after about 1995. Not only is that sort of employee loyalty rare these days, it can suggest stagnation, since few employers invest in developing their employees any more. Although that can be mitigated by demonstrating a series of significant promotions, changes in role, and assumption of greater responsibility.
As a hiring manager, I expect a resume to reflect a mix of tenures ranging from ~18 months to 3 or 4 years. If you have more than one <9 month stay for every two places you stuck around for at least 18 months, I'll probably give you a pass. It's not worth my while to hire for the same position twice in one year.
Edited for typos.