Soil salinization and alkalization severely inhibit agriculture. However, the response mechanisms of cotton to salt stress or alkali stress are unclear. Ionomics and metabolomics were used to investigate salt and alkali stresses in cotton roots and leaves. Compared with the control, salt-treated and alkali-treated cotton plants showed 51.8 and 53.0% decreases in biomass, respectively. Under salt stress, the concentration of N decreased in roots but increased in leaves, and the concentrations of P and K increased in roots but decreased in leaves. Salt stress inhibited Ca, B, N, and Fe uptake and Mg, K, P, S, and Cu transport, but promoted Mo, Mn, Zn, Mg, K, P, S, and Cu uptake and Mo, Mn, Zn, B, N, and Fe transport. Under alkali stress, the concentrations of N and P in roots and leaves decreased, while the concentrations of K in roots and leaves increased. Alkali stress inhibited P, Ca, S, N, Fe, and Zn uptake and N, P, Mg and B transport, but promoted K, Mn, Cu, Mo, Mg, and B uptake and K, Mn, Cu, Mo, Fe, and Zn transport. Under salt stress in the leaves, 93 metabolites increased, mainly organic acids, amino acids, and sugars, increased in abundance, while 6 decreased. In the roots, 72 metabolites increased, mainly amino acids, organic acids, and sugars, while 18 decreased. Under alkali stress, in the leaves, 96 metabolites increased, including organic acids, amino acids, and sugars, 83 metabolites decreased, including organic acids, amino acids, and sugars; In the roots, 108 metabolites increased, including organic acids, amino acids, and sugars. 83 metabolites decreased, including organic acids and amino acids. Under salt stress, cotton adapts to osmotic stress through the accumulation of organic acids, amino acids and sugars, while under alkali stress, osmoregulation was achieved via inorganic ion accumulation. Under salt stress, significant metabolic pathways in the leaves and roots were associated with amino acid and organic acid metabolism, sugar metabolism was mainly used as a source of energy, while under alkali stress, the pathways in the leaves were related to amino acid and linoleic acid metabolism, β-Oxidation, TCA cycle, and glycolysis were enhanced to provide the energy needed for life activities. Enhancing organic acid accumulation and metabolism in the roots is the key response mechanism of cotton to alkalinity.