The Ultra-Orthodox Shas party says it will leave the government in response to dispute over mandatory military service.