Why do plant leaves turn yellow if they don't get enough water or get too much water? I want to know the process.
I've been searching in Google for an explanation, but none of the sites did. Please describe the process.
Usually it is termed chlorosis, and comes about from an inability to produce chlorophyll. It can actually be determined by a whole range of things, and not just water shortage or waterlogged soil, including nutrient deficiencies, pathogen infection or unbalanced soil pH.
A lot of these factors relate to an inability of the plant root system to properly take up water. As you probably know, water enters the root system to be carried up into the shoot (through the xylem) mostly driven by transpiration, the water pressure caused by loss of water through the leaves. This water carries with it the soil-derived nutrients the plant needs to synthesise substances that can't be produced by photosynthesis. So if you change the water balance (for example by drying the soil) it becomes difficult for plants to get the nutrients they require to produce chlorophyll.
Usually this is mediated by reduced supplies of magnesium, iron or zinc, but because the precursor to chlorophyll is an amino acid, it can also be caused by shortages of nitrogen. pH comes into play because plants use a delicate balance of acidic ions to mobilise (make available to the roots) the nutrients in the soil, and if the soil pH differs too much this becomes untenable.
So in summary it relates both to shortages of key nutrients or changes in key soil characteristics, and the ability of the plant root system to uptake these key nutrients. It is mediated by these effects leading to an inability to produce enough chlorophyll, which leads to the yellowing leaves that you observe.