Does leaving a lab disqualify me from being a coauthor?
If you would have qualified as an author otherwise, the act of leaving a lab should not disqualify you. However, make sure you would have qualified as an author under normal circumstances before confronting someone about it. Most journals and universities have their own authorship policies. You could use these policies as a starting point to talk your lab mates about being included as an authors on this paper.

For example, the IEEE authorship policy: https://www.ieee.org/publications_standards/publications/authors/author_ethics.html

You can look up your own university's authorship policy.

However, be aware that most policies place a much greater emphasis on writing/drafting, and higher level design or analysis work than they do on low-level activities. Just working on a project for two years is not necessarily enough to qualify you for authorship on any paper related to that project. The kind of work you performed and it's relation to the published paper is what is really crucial here. 

For example, simple data gathering is usually not enough to qualify one for authorship under most policies. Spending time doing tool-building or building an experiment that you did not design are also activities that probably don't qualify you for authorship on their own. Designing an experiment included in a paper does qualify for authorship. Spending time with the other authors comparing and contrasting competing explanations of data might qualify for authorship, depending on your overall role and contribution in the project. 

In my experience I have seen people not have authorship when they spent a significant amount of time testing and validating an experimental setup that they did not design. In this case they were more of a paid technician than a researcher, even though they were working with research equipment and contributing to a research project. 

I contrast, I know a guy who did get authorship for simply coming up with a really good idea and doing zero work. He was a graduating PhD student and had a great research idea that the others in his lab implemented and evaluated. Even though he did zero work on the project or paper his colleagues thought that the single original idea was enough of an intellectual contribution to grant authorship.