Organ transplantation is a life-saving treatment for patients with end-stage disease, but survival rates after transplantation vary considerably. There is now increasing evidence that the gut microbiome is linked to the survival of patients undergoing hematopoietic cell transplant, yet little is known about the role of the gut microbiome in solid organ transplantation. We analyzed 1370 fecal samples from 415 liver and 672 renal transplant recipients using shotgun metagenomic sequencing to assess microbial taxonomy, metabolic pathways, antibiotic resistance genes, and virulence factors. To quantify taxonomic and metabolic dysbiosis, we also analyzed 1183 age-, sex-, and body mass index-matched controls from the same population. In addition, a subset of 78 renal transplant recipients was followed longitudinally from pretransplantation to 24 months after transplantation. Our data showed that both liver and kidney transplant recipients suffered from gut dysbiosis, including lower microbial diversity, increased abundance of unhealthy microbial species, decreased abundance of important metabolic pathways, and increased prevalence and diversity of antibiotic resistance genes and virulence factors. These changes were found to persist up to 20 years after transplantation. Last, we demonstrated that the use of immunosuppressive drugs was associated with the observed dysbiosis and that the extent of dysbiosis was associated with increased mortality after transplantation. This study represents a step toward potential microbiome-targeted interventions that might influence the outcomes of recipients of solid organ transplantation.