An employer cannot stop you from quitting job or leaving the country under normal circumstances. Terms for termination of employment will be mentioned in the employment contract. Usually its a 1 month notice you need to give to the employer if you intend to leave the job. It is true that you need an exit permit approved by employer to leave Qatar at any point of time. It is unlikely that a company do not issue exit permit unless the employee has done a crime or anything similar.