MacBook Pro with TouchBar - Compatibility with Ubuntu?
The Macbook Pro's Touchbar runs software similar to the Apple Watch's WatchOS (I'll call it TouchbarOS), entirely separate from the macOS the computer itself runs on. TouchbarOS automatically switches to standard function keys when the physical keyboard's function key is pressed. 

I can only assume TouchbarOS sends the exact same message when a function key is pressed on the Touchbar than when it is pressed on a physical keyboard, so yes, the standard function keys (though almost definitely nothing else the Touchbar does) should work with Ubuntu.

For more on the Touchbar and standard function keys, see this Apple support page.