One needs to have an NOC from his/her previous sponsor to come back to Qatar before two years. This has nothing to do whether one goes back before or after the expiry contract.