This is one of the most controversial topics and why not? It involves some really detailed physiology and multiple processes. Generally this means getting your head around things you cannot usually see. I shall only discuss juvenile and adult fishes rather then their eggs here.

First is to understand the anatomy we are discussing in relation to the topic, this is largely the gills found in all fishes.

The gills while largely known for taking up O2 and release CO2 so have a role in respiration this organ has other purposes. Two major functions are maintenance in osmoregulation and processing of nitrogenous waste, ammonium (NH4+). You can see that the gills are split into gill arches which support two gill filaments, these filaments are then made of many small structures called lamellae (Fig 1). The aim of these structures is to increase surface area so exposure to the water for these purposes.
Another organ that might be discussed is the kidneys, but forget whatever you previously thought about kidneys, fishes kidneys look very different. The structure isn’t really of much use to us but it is generally a thin stretched structure at the top of the fish if curious this website is great for necropsy images: https://www.necropsymanual.net/en/teleosts-anatomy/excretory-and-osmo-regulatory-system/
So lets get into the real physiology.
pH
pH to put simply is a measure of hydrogen ions (H+, reduces the pH) and hydroxide (OH–, increases the pH), it measured in a logarithmic scale so a pH of 6 is 10x more acidic then a pH of 7.
This measure has two main interactions with fishes ammonia excretion and uptake/maintenance of minerals within fishes.
High pH
Ammonia generally exists in two states ammonia (NH3) and ammonium (NH4+). At higher pH levels ammonia is the dominant compound, at lower pH’s it is converted to the safer ammonium. At a higher pH environment the fish has a reduced ability to transport ammonia out of the body, leading to accumulation within the fishes body (Eddy & Handy, 2012; Wilkie & Wood, 1996).
Low pH
It is well known fishes take up calcium (Ca2+) and sodium (Na+) from their environment, it is important for many biological processes. H+, in higher volumes in low pH water competes with calcium and sodium to be taken up by the fishes. In a similar process to how a high pH results in high ammonia accumulation a low pH increases excretion of ammonium (Malabarba et al., 2020). Although a low pH is not particularly toxic (Eddy & Handy, 2012), it does limit access to these compounds. Many fishes who inhabit these environments have evolved different physiological responses to allow them to inhabit such an environment.
One interaction of a low pH would be that this erodes rocks even slowly that can allow for aluminum to accumulate in it’s more toxic form, Al3+(Eddy & Handy, 2012). This shouldn’t be an issue in a well water changed aquarium, but could be a contributor to “old tank syndrome”.
Regardless this is generally discussed at extremes and not usually the parameters we keep our fishes in.
Hardness, the various measures under that name
Hardness maybe is more complex, the aquarium trade associates it largely with KH or GH but realistically there are so many compounds involved that we are not testing for. These compounds are what is discussed in the scientific literature (Malabarba et al., 2020). I prefer TDS or conductivity, not just are these likely the only measures you’ll find for wild fishes.
Low hardness
At a low hardness ionic balance as discussed in the pH section would become difficult. This results in the increase in cells that maintain this balance known as ionocytes (Malabarba et al., 2020).
High hardness
High hardness can result in stress from calcium in the gills, liver and intestines at extreme levels but fishes do show the ability to adapt (Limbaugh et al., 2012).
Adaptability
Many fishes clearly display adaptations to deal with extremes, this depends on the species to it’s ideal range and what it can deal with (Eddy & Handy, 2012; Malabarba et al., 2020). So unless a species has been studied we really don’t know how much they can adapt to.
Summary
It is really difficult to say how compounds interact with fishes in the aquarium context, we are dealing with such a comparatively narrow range of parameters. Recently people have been even avoiding the extremes on the lower side so it’s become difficult to say to much. This topic unlike many is discussing such a wide diversity of taxa and many inhabit variable regions.
References:
Campbell, N. A., Reece, J. B., Taylor, M. R., Simon, E. J., & Dickey, J. (2006). Biology: concepts & connections (pp. 70-78). San Francisco, CA: Benjamin Cummings.
Eddy, B., & Handy, R. D. (2012). Ecological and environmental physiology of fishes (Vol. 4). Oxford University Press.
Limbaugh, N., Romano, N., Egnew, N., Shrivastava, J., Bishop, W. M., & Sinha, A. K. (2021). Coping strategies in response to different levels of elevated water hardness in channel catfish (Ictalurus punctatus): Insight into ion-regulatory and histopathological modulations. Comparative Biochemistry and Physiology Part A: Molecular & Integrative Physiology, 260, 111040.
Malabarba, L. R., Malabarba, M. C., Baldisserotto, B., Urbinati, E., & Cyrino, J. (2020). Biology and physiology of freshwater neotropical fish. Academic Press.
Wilkie, M. P., & Wood, C. M. (1996). The adaptations of fish to extremely alkaline environments. Comparative Biochemistry and Physiology Part B: Biochemistry and Molecular Biology, 113(4), 665-673.
