We propose and demonstrate a novel system for simultaneous ammonia recovery, carbon capture, biogas upgrading, and fertilizer production in biogas production. Biogas slurry pretreatment (adjusting the solution pH, turbidity, and chemical oxygen demand) plays an important role in the system as it significantly affects the performance of ammonia recovery. Vacuum membrane distillation is used to recover ammonia from biogas slurry at various conditions. The ammonia removal efficiency in vacuum membrane distillation is around 75% regardless of the ammonia concentration of the biogas slurry. The recovered ammonia is used for CO2 absorption to realize simultaneous biogas upgrading and fertilizer generation. CO2 absorption performance of the recovered ammonia (absorption capacity and rate) is compared with a conventional model absorbent. Theoretical results on biogas upgrading are also provided. After ammonia recovery, the treated biogas slurry has significantly reduced phytotoxicity, improving the applicability for agricultural irrigation. The novel concept demonstrated in this study shows great potential in closing the CO2 loop in biogas production by recycling ammonia as an absorbent for CO2 absorption associated with producing fertilizers.