There is no condition on a 186 visa grant that states you must remain with your employer for 2 years, likewise there's no condition that your employer must keep you 2 years either.
However, you do declare your intention to remain for 2 years when you apply for the visa (likewise the employer does in the nomination), but really that's not legally enforceable. If you were to resign the day you get your visa grant, it's possible your employer could complain to DIBP that you'd simply used them to get a visa and perhaps DIBP would look into it. But I've never heard of this happening. Many people leave their employers, perhaps several weeks or months after getting their visas, and this has no repercussions on their visa or eligibility for citizenship.
186 visa - Temporary Residence Transition stream
Granted Dec 2013