During past ages, there was rain and snow on Mars; especially in the Noachian and early Hesperian epochs.  Some moisture entered the ground and formed aquifers. That is, the water went into the ground, seeped down until it reached a formation that would not allow it to penetrate further (such a layer is called impermeable). Water then accumulated forming a saturated layer. Deep aquifers may still exist.

Overviews

Researchers have found that Mars had a planet-wide groundwater system and several prominent features on the planet have been produced by the action of groundwater.  When water rose to the surface or near the surface, various minerals were deposited and sediments became cemented together.  Some of the minerals were sulfates that were probably produced when water dissolved sulfur from underground rocks, and then became oxidized when it came into contact with the air. While traveling through the aquifer, the water passed through  igneous rock basalt, which would have contained sulfur.

In an aquifer, water occupies open space (pore space) that lies between rock particles.  This layer would spread out, eventually coming to be under most of the Martian surface. The top of this layer is called the water table.  Calculations show that the water table on Mars was for a time 600 meters below the surface.

The InSight lander uncovered in September 2019 unexplained magnetic pulses, and magnetic oscillations consistent with an existing  planet-wide reservoir of liquid water deep underground.

Researchers have concluded that Gale Crater has experienced many episodes of groundwater surge with changes in the groundwater chemistry.  These chemical changes would support life.

Layered terrain

Some locations on the Red Planet show groups of layered rocks.  Rock layers are present under the resistant caps of pedestal craters, on the floors of many large impact craters, and in the area called Arabia.  In some places the layers are arranged into regular patterns.  It has been suggested that the layers were put into place by volcanoes, the wind, or by being at the bottom of a lake or sea.  Calculations and simulations show that groundwater carrying dissolved minerals would surface in the same locations that have abundant rock layers.  According to these ideas, deep canyons and large craters would receive water coming from the ground.  Many craters in the Arabia area of Mars contain groups of layers.  Some of these layers may have resulted from climate change.

The tilt of the rotational axis of Mars has repeatedly changed in the past.  Some changes are large.  Because of these variations of climate, at times the atmosphere of Mars would have been much thicker and contained more moisture.  The amount of atmospheric dust also has increased and decreased. It is believed that these frequent changes helped to deposit material in craters and other low places. The rising of mineral-rich ground water cemented these materials. The model also predicts that after a crater is full of layered rocks, additional layers will be laid down in the area around the crater. So, the model predicts that layers may also have formed in intercrater regions; layers in these regions have been observed.

Layers can be hardened by the action of groundwater.  Martian ground water probably moved hundreds of kilometers, and in the process it dissolved many minerals from the rock it passed through.  When ground water surfaces in low areas containing sediments, water evaporates in the thin atmosphere and leaves behind minerals as deposits and/or cementing agents. Consequently, layers of dust could not later easily erode away since they were cemented together. On Earth, mineral-rich waters often evaporate forming large deposits of various types of salts and other minerals. Sometimes water flows through Earth's aquifers, and then evaporates at the surface just as is hypothesized for Mars.  One location this occurs on Earth is the Great Artesian Basin of Australia.  On Earth the hardness of many sedimentary rocks, like sandstone, is largely due to the cement that was put in place as water passed through.

In February 2019, European scientists published geological evidence of an ancient planet-wide groundwater system that was, arguably, connected to a putative vast ocean.

Layers in Crommelin crater

Layers in Danielson crater

Inverted terrain

Many areas on Mars show inverted relief.  In those places, former stream channels are displayed as raised beds, instead of stream valleys.  Raised beds form when old stream channels become filled with material that is resistant to erosion.  After later erosion removes surrounding soft materials, more resistant materials that were deposited in the stream bed are left behind. Lava is one substance that can flow down valleys and produce such inverted terrain.  However, fairly loose materials can get quite hard and erosion resistant when cemented by minerals.  These minerals can come from groundwater.  It is thought that a low point, like a valley focuses groundflow, so more water and cements move into it, and this results in a greater degree of cementation.

Terrain inversion can also happen without cementation by groundwater, however. If a surface is being eroded by wind, the necessary contrast in erodibility can arise simply from variations in grain size of loose sediments. Since wind can carry away sand but not cobbles, for example, a channel bed rich in cobbles could form an inverted ridge if it was originally surrounded by much finer sediments, even if the sediments were not cemented. This effect has been invoked for channels in Saheki crater.

Places on Mars that contain layers in the bottoms of craters often also have inverted terrain.

Evidence for groundwater upwelling

Spacecraft sent to Mars provided a wealth of evidence for groundwater being a major cause of many rock layers on the planet.  The Opportunity Rover studied some areas with sophisticated instruments.  Opportunity’s observations showed that groundwater repeatedly had risen to the surface.  Evidence for water coming to the surface a number of times include hematite concretions (called "blue berries"), cementation of sediments, alteration of sediments, and clasts or skeletons of formed crystals.

  To produce skeleton crystals, dissolved minerals were deposited as mineral crystals, and then the crystals were dissolved when more water came to the surface at a later time.  The shape of the crystals could still be made out.
Opportunity found hematite and sulfates in many places as it traveled on the surface of Mars, so it is assumed that the same types of deposits are widespread, just as predicted by the model.

Orbiting probes showed that the type of rock around Opportunity was present in a very large area that included Arabia, which is about as large as Europe.  A spectroscope, called CRISM, on the Mars Reconnaissance Orbiter found sulfates in many of the same places that the upwelling water model had predicted, including some areas of Arabia.  The model predicted deposits in Valles Marineris canyons; these deposits have been observed and found to contain sulfates.
Other locations predicted to have upwelling water, for example chaos regions and canyons associated with large outflows, have also been found to contain sulfates. 
Layers occur in the types of locations predicted by this model of groundwater evaporating at the surface.  They were discovered by the Mars Global Surveyor and HiRISE onboard Mars Reconnaissance Orbiter.  Layers have been observed around the site that Opportunity landed and in nearby Arabia.  The ground under the cap of pedestal craters sometimes displays numerous layers.  The cap of a pedestal crater protects material under it from eroding away.  It is accepted that the material that now is only found under the pedestal crater’s cap formerly covered the whole region.  Hence, layers now just visible under pedestal craters once covered the whole area.
Some craters contain mounds of layered material that reach above the crater’s rim.  Gale Crater and Crommelin (Martian crater) are two craters that hold large mounds.  Such tall mounds were formed, according to this model, by layers that first filled the crater, and then continued to build up around the surrounding region.  Later erosion removed material around the crater, but left a mound in the crater that was higher than its rim.
Note that although the model predicts upwelling and evaporation that should have produced layers in other areas (Northern lowlands), these areas do not show layers because the layers were formed long ago in the Early Hesperian Epoch and were therefore subsequently buried by later deposits.

Strong evidence for groundwater making lakes in deep craters was described by a group of European scientists in February 2019.  Craters examined did not show inlets or outlets; therefore, water for the lake would have come from the ground. These craters had  floors lying roughly 4000 m below Martian 'sea level'.  Features and minerals on the floors of these craters could only have formed in the presence of water. Some of the features were deltas and terraces.  Some of the craters studied were Oyama, Pettit, Sagan, Tombaugh, Mclaughlin, du Martheray, Nicholson, Curie, and Wahoo.  It seems that if a crater was deep enough, water came out of the ground and a lake was formed.

Pedestal craters

See also

References

Bodies of water
Water on Mars