This study examined the fermentation dynamics, bacterial community composition and bacterial β-carotene synthesis in alfalfa that was ensiled for 3, 15, 45 and 90 days without additives (CON), or with a chemical agent (propionic acid, PA); or a combination of PA and squalene, SQPA). The results showed that silage treated with PA had a lower (P < 0.01) pH value than the CON silage in the early ensiling phase (3–15 days). Meanwhile, silage treated with PA had the highest contents of lactic acid, acetic acid and PA after 90 days of ensiling (P < 0.01). The β-carotene in alfalfa was lost seriously in the initial ensiling phase (3 days) and epiphytic Pantoea agglomerans with the ability to produce β-carotene became extinct. With the extension of ensiling time, the loss of β-carotene was alleviated in all silages. PA and SQPA not only lowered bacterial diversity and simplified bacterial networks but also facilitated the emergence of new β-carotene-producing bacteria. The metabolic function prediction indicated that β-carotene synthesis tended to decrease initially and subsequently increase during ensiling. Furthermore, the variance of enzymes involved in the bacterial synthesis of β-carotene in silages was influenced by PA, SQPA and ensiling time. In summary, the impact of solely adding PA demonstrated superior effects on the fermentation quality of alfalfa silage compared to the effects observed with SQPA. Throughout the ensiling of alfalfa, the succession of different β-carotene-producing bacteria resulted in fluctuations in the levels of β-carotene.