Most employment positions in the US are at-will, meaning either party is legally allowed to terminate at any point for no reason given, barring legal protections against discussion and retaliation.
It's different if you're a contractor (i.e. not an employee but hired for a specific contractor term) or in a union (not an issue for most software engineers). My experience with both is indirect.