Polygonum multiflorum Thunb. is a traditional Chinese medicine with extensive distribution and robust adaptability, but comprehensive research on its acid and alkali resistance is presently lacking. This study aimed to analyze the effects of 5 months of continuous pH stress on the physiological and photosynthetic parameters of P. multiflorum, and the content of effective components. Results revealed that pH stress significantly influenced the normal growth, physiological functions, and photosynthetic indicators of P. multiflorum. At soil pH 4.5, the tubers of P. multiflorum exhibited the highest levels of 2,3,5,4′-tetrahydroxy stilbene-2-O-β-d-glucoside (THSG) and total anthraquinones at 5.41% and 0.38%, respectively. However, increased soil pH significantly reduced the content of THSG and total anthraquinones. Reference-free transcriptome analysis was further conducted on P. multiflorum treated at pH 4.5 and 9.5, generating a total of 47,305 unigenes with an N50 of 2118 bp, of which 31,058 (65.65%) were annotated. Additionally, 2472 differentially expressed genes (DEGs) were identified. Among them, 17 DEGs associated with the biosynthesis of THSG and anthraquinones were screened. A comprehensive analysis of differential gene expression and effective component content demonstrated a significant positive correlation between the content of effective components and the 14 DEGs’ expression but a negative correlation with soil pH. This study highlighted the influence of varying soil pH values on the effective component content of P. multiflorum. Specific acidic conditions proved beneficial for the synthesis and accumulation of THSG and total anthraquinones in P. multiflorum, thereby enhancing the quality of the medicinal material.