Phenolics play a crucial role in plant defense mechanisms against increased UV-B radiation. Due to their significant medicinal properties, the phenolic compounds produced by Juniperus rigida have great potential as valuable sources for medicine. However, the process of synthesizing J. rigida phenolics under UV-B treatment remained unclear. To investigate the mechanism of J. rigida phenolic synthesis, this study examined the pattern of phenolics in J. rigida by analyzing its morphological structure, physiology, and key enzyme genes. The results showed that the phenolic compounds in J. rigida increased under low-intensity UV-B treatment, whereas a decrease was observed under high-intensity UV-B treatment. In particular, rutin and quercitrin were identified as key contributors to the antioxidant activity under UV-B treatment. Phenolics were mainly found in living cells of J. rigida needles, such as the vesicle-containing sheath cells, secretory cells, palisade tissue, spongy tissue, epidermis, endodermis, and parenchyma. Furthermore, the cell nucleus was significantly larger and darker after UV-B treatment. There were also temporal differences between the gene expression and accumulation of bioactive compound. Notably, 4CL, CHS, CHI, FLS, and PLR are the key genes for phenolics synthesis among the differentially expressed genes. These findings would not only elucidate the biosynthetic mechanism of phenolic compounds in J. rigida, but also provide a scientific basis for the use of UV-B radiation to synthesize active compounds in medicinal plants.