If they did, did they utilize them for farming? If so, how would they?
Awareness of underground rivers dates back many thousands of years.
In Babylon, there is
a bronze Babylonian panel showing a visit to caves near the source of the Tigris in about 852 BC....We see stalagmites and, in the lower portion, an underground river.
The underground city of Derinkuyu, which may have housed as many as 20,000 people, is perhaps the most obvious example of an underground river being made use of. When exactly it was built is uncertain but it may have been before 1200 BC. Wikipedia, though, citing the Turkish Department of Culture, gives dates of 8th to 7th centuries BC. The city needed water like any other city and had wells supplied by an underground river.
The Greek geographer Strabo, writing during the time of the Roman Repbublic, mentions a number of underground rivers, including
Erasmus which now flows underground from the Stymphalian Lake and issues forth into the Argive country, although in earlier times it had no outlet, since the berethra [pits] which the Arcadians call "zerethra" were stopped up and did not admit of the waters being carried off.
Also, there is an example of trying to block an underground river in order to defeat an enemy.
The Stymphalus was said by Diodorus of Sicily, writing between 56 and 36 BC, to descend underground through a sinkhole, flow 32 kilometers through underground passages, and resurface before emptying into the Gulf of Argos.
...when Iphicrates was besieging the Spartan town of Stymphalus ... it was said that he attempted to inundate the defenses by blocking the sink with sponges.
The Spartans had used a similar tactic against the Argives at the Battle of Mantinea (418 BC).
In the Phong Nha-Kẻ Bàng National Park, the Phong Nha Cave has a river and a long history of occupation. It is
7729 m long, contains 14 grottos, with a 13,969 m-long underground river.
River flowing into the Phong Nha cave, Phong Nha-Kẻ Bàng National Park, Vietnam. Attrib: By [Tycho] talk , http://shansov.net (Own work) [CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons
There is evidence of occupation dating back 8,000 years. Also,
In 1995, the Archeological Institute of Vietnam remarked that Phong Nha cave is probably an extremely important archeological site. This organization suggested that what remained in Bi Ky grotto may have been a Champa mosque from the 9th to 11th century. Inside Phong Nha cave, many Champa style ceramics, earthware vases with lotus-shaped ruby-colored, slight pink mouth.
Since the ancient times the local Batak people knew about the existance of large underground river in these rugged mountains. This river could be entered by... boats directly from the sea. Batak people believed that in the cave lives an evil spirit and were afraid to enter it.
In Iran (but not sure if this one really counts) the qanat system developed 3,000 years ago,
is an elegant network of underground aqueducts...The water of a qanat comes from a natural aquifer located deep in the ground at the side of a mountain.
As for use,
The main driving force behind qanat building traditionally was that it provided irrigation water for agriculture. The outlet of the qanat was thus located close to farmlands, and the farms were located at a lower elevation than the outlet so that water could be diverted to farms using ditches and gravity.
According to the Wiki page linked above, the caves of Škocjan have been inhabited since the middle stone ages. IIRC not only were Reka and Timavo known by ancient Romans and Greeks, but also the connection had been guessed (the flux has high seasonal variability, also there are some caves in the carso in between where sometimes the underground river can be heard - I have no idea, though, whether this was known before the systematic exploration in the 19th century). And the Reka sinkhole cave is by far not the only one in the region. I'd assume that such caves where known as soon as humans settled in that region. You literally walk into them and see the river disappear in the dark or you walk up the river and find it appearing from a spithole, which also can be in a cave. At some points the connection is obvious and the water just tunnels below a hill or a bridge between two dolinas that are parts of the cave system where the roof fell. This can be observed by a curious human walking these parts.
Proper proof of the connection (as with many similar systems such as Danube - Radolfzeller Aach) is recent, though: this is done by marker experiments. And the Reka/Timavo system is still under research. See here about a tracer experiment October 2017..
As for uses:
- underground rivers are obviously in the dark, so not immediately suitable for farming.
However, the valleys where they are above ground were (and are) good for farming. There, in addition to the water you also find the loam deposited by the river, whereas the carst hills are pretty much naked limestone (and the soil is washed down by the water going into the crevices of the limestone)
In the 19th century, the Reka - Timavo system was explored hoping to gain access to drinking water for Trieste which grew from 21000 inhabitants in 1800 to 134000 inhabitants in 1900. This was so urgent that pretty much every crack in the carst was explored and surveyed. The underground river was found, e.g. in a cave near Trebiciano but basically is at sea level, i.e. about 300 m below the earth surface. Turned out to be easier to build a drinking water supply plant 20 km further west where the water emerges at the source of the Timavo.
Also, part of the Reka comes out as part of the Timavo: water easily penetrates the limestone in the carst, so roughly the whole region is an interconnected water system under and above ground (this is very much a water system where the earth surface happens to be above or below the water level).
Note these connections mean that the flow can and frequently does reverse. In general, I'd assume this phenomenon has also been known since prehistorical times, e.g. by the inhabitants at the Lake Cerknica: this lake seasonally disappears, and there's a stage where you see creeks going into sinkholes, which just turn into spitholes when the lake reappears. When there, it does have fish, so it cannot just be like a puddle that dries and is filled again by the next rain.
Again, Lake Cerknica was known to the ancient Greeks, but I don't know how much about the underground water systems was known then.