When you accept a tenure-track position in the USA, how long are you expected to stay? Does it look bad if you change jobs a couple times after a few years at each university? Is there an unspoken standard?
This can be a little tricky. There are two issues: what your obligations are to the university, and what could look bad on your CV and hurt future job searches.
Your legal obligations may vary depending on the country or the details of your contract, but my understanding of the U.S. social norms is the following:
Once you have accepted a job, you must show up for it. (I.e., you will offend people if you try to change your mind and accept another job instead.) You should stay for at least a year, except for health emergencies and the like, and preferably for a couple of years, since it looks bad if you apply for other jobs immediately upon arriving. Beyond that, the department may be unhappy if you leave, but you won't be doing anything offensive.
On the other hand, you shouldn't make a habit of this. When a department hires someone for a tenure-track job, they are looking for a long-term colleague. It's still possible to get hired even if the department knows you are unlikely to stay long, but you have to be extra-brilliant to make up for this. If you leave a couple of universities quickly, then it will look like a pattern, and everyone else will be less interested in hiring you than they might otherwise have been.
If you end up in this situation through bad luck, then the next time you apply for jobs you should try to explain what happened in a way that makes it clear why it is unlikely to happen again.