In most cases, you won't know a network is "compromised," whatever that means. In the unlikely event you do know (maybe your IT department issued a warning) you don't turn off WiFi, you immediately disconnect from it (which the Control Center will do), then go to Settings/WiFi and forget the network. You will never connect to it again except by choice. To do the same thing by turning off WiFi you would have to leave it off for the rest of your life.
Note that there are currently no WiFi vulnerabilities on an iOS device (with version 10.3.3 or later), and if any are discovered Apple will issue a security update almost immediately.
Open networks that do not implement encryption (any that don't require login or have you log in via a web page as their only security) such as Starbuck's are also safe to use as long as you never go to a web page that does not implement SSL. That means pages that begin "https://". All apps are required to use SSL, and the default for mail, unless you turn it off, is SSL.
i'm sure people smarter than I will be able to think of more security risks than I was capable of thinking of in the 13 seconds I thought about this situation. But i'm sure apple thought about this as well.
A whole team of people smarter than you, at least on the subject of Internet security, have thought about it a lot, probably for over a year, and the latest version of iOS 11 is the result.
They've also implemented some "under the hood" protection that you never see. Since late 2014 any time your iOS device is "pinged" by a network that it is not already "paired" the device returns a randomly generated MAC (WiFi) address that changes constantly. This is to protect you from the practice of tracking you through your device's address. Most other companies are now copying this innovation, but Apple was the first.