See https://news.ycombinator.com/reply?id=21700802 and https://en.wikipedia.org/wiki/User:Guy_Macon/Wikipedia_has_C...
The WMF has no plans to sell out to a commercial outfit like Google or Facebook , but is it actually illegal for them to do so?
See https://money.cnn.com/2008/01/15/smbusiness/non_profit_sale....
While it can be difficult to sell a nonprofit like Wikipedia to someone like Google or Facebook, it isn't impossible.
There are two ways that the commercial entity could get a court to agree with the sale and both of them start with the WMF screwing up so badly that they run out of money and need to either sell of shut down. We are nowhere near that, but it could happen in the future. I have talked this over with people who appear to know the law on this, but I am an engineer, not a lawyer. If a real lawyer replies, please ignore me and listen to them.
There are a couple of things the commercial entity could do to make it more likely to get approval from a court.
They could simply say that they are abandoning all of the federal and state tax exemptions that a nonprofit enjoys. The easy way to do this would be for the wikipedia.org domain to announce the end of wikipedia and tell everyone that they have accounts with the same usernames and passwords on the new wikipedia.google.com site which runs the exact same software and has the exact same content as the now-frozen wikipedia.com version. Add the usual "we don't plan on changing anything; we just want to save the now-failed wikipedia" language.
Or they could create a new, independent nonprofit with the same rules as the WMF has now but with funding by a generous donation from Google and fork the content as above. As above, the key to making this work is the existing Wikipedia running out of money and shutting down.
So, while it isn't going to happen any time soon, it isn't actually illegal.