No, GoPro touchscreens don't work underwater.
For now, the touch-sensitive displays that we've become used to on all sorts of devices don't work underwater. That's true of the touchscreens on smartphones and cameras, including the screens on the back of the GoPro HERO5 Black and HERO4 Silver.
Current touchscreens use technology that is sensitive to a slight electrical charge, or what's known as capacitance sensing. Patents have been granted for technology aiming to solve that limitation by using other methods of registering input on touchscreens, but right now it's not technology that's available in consumer devices.
If you're using it at the water's surface, part in and part out of the water, you'll also find that a drop of water can also confuse the touchscreen, and you can get some wacky results. You'll see this quickly if your smartphone gets some droplets on it. I often find that it can change the shooting mode or activate things like the auto exposure spot meter. So it's worth keeping an eye on it, just in case you find it in the wrong mode when you go to shoot.
Of course, your GoPro can work underwater. And the touchscreen will continue to work normally as a digital viewfinder to display the live view, playback videos and photos, and access menu options. Being able to see what you're shooting is especially useful underwater. You just won't be able to interact with them with touch (or wifi, for that matter) to change settings. For that you'll need to the use the buttons.
For mode and menu changes, the buttons work well. One major feature that there's no alternative for touchscreen control, though is if you're using the HERO5 Black's Exposure Control feature.
Do GoPro Touchscreens Work in Rain?
Yes, GoPro touchscreens do work in the rain, although the responsiveness might not be as good as when it's dry.
If the camera is not fully submerged, you should be able to get response out of the touchscreen. Drops of water, and even wet fingers, can still make it work, although you'll probably find it's not as reliably responsive as normal. And sometimes you can end up accessing features accidentally, such as the exposure point feature. But you should be able to get enough of a signal to get where you want in the menus.