I applied for a job here in Upwork because of an enticing offer in the job description but when I signed the contract I was surprised that it was not within the Upwork Platform, I am just wondering if the move by my employer is legal. I am also concerned by his move that I might be working for his company and in the future might not get paid.
You actually just violated almost every Upwork Terms of Service rule doing that and could actually get your account suspended or banned for doing that. If the contract was 'outside' Upwork, then you shouldn't have signed it.
Part of trying new things is making mistakes.
It would be great if you could take some time to read this:
Meanwhile, what you need to do is immediately navigate to the name or avatar image of the "client" you hired you and right click to show the contextual menu. Choose the option to "block" that person.