Governments can generally do what they want when it comes to foreign nationals, provided they aren't breaking any international treaties. And regardless of the spying involved in this case, the US is free to kick out anybody on a visa that it doesn't like at any time for any reason. It's not nice but that's how it is.