At a glance I'd say "no", but the ethics depends on the situation. You are always free to leave any company usually with some time of notice bound by your contract. It would be unethical if your company forces you to stay as that would be the same as slavery (which is strictly forbidden in many countries around the world with few exceptions). It is not your problem if your current employer has a employee retention problem.

On the other hand, leaving in the middle of a project where you are a key player is a bit sleazy and may lead to problems ahead when you're looking. Word travels fast among your colleagues within the industry and you usually have to present some references. It will become a major issue when you're hunting for jobs.

You should always discuss with your boss that you have issues with any project you're working on. Sometimes the discussion may lead to other avenues that are better for all parties involved. So think it through and "outside the box", you might find other solutions to the same problem.

If you consider to quit; remember that doing so before you've lined up a new job is risky and a bit stupid. Look for other opportunities discretely and move on when you've found something. Until then take the time to get some experience with the project (a little experience doing some brownfield work always looks good on a resume). Stick with your current situation before you are able, with full confidence, to move on.