The St. Louis Cardinals selected Weaver in the first round of the 2014 Major League Baseball draft. He signed with the Cardinals on June 16 and made his professional debut for the GCL Cardinals. He was promoted to the Palm Beach Cardinals on August 1. In six starts between the two teams, he was 0–1 with a 7.71 ERA and 2.04 WHIP. Weaver spent 2015 with Palm Beach. He earned the Cardinals July Pitcher of the Month Award after compiling a 3–1 record and an 0.94 ERA in innings pitched in five starts. He also struck out 27 and walked only two during the month. Baseball America selected Weaver for the high Class-A minor leagues All-Star team for the 2015 season, In 19 total starts for Palm Beach in 2015, he pitched to an 8–5 record and 1.62 ERA. Baseball America ranked Weaver as the Cardinals' fourth-best prospect prior to the 2016 season. He did not make his 2016 debut for the Springfield Cardinals until June 4 because of a fractured left wrist sustained while running down fly balls during batting practice in spring training. In their updated mid-season ranking, Baseball America rated Weaver in the top-100 for the first time, at 75th. After posting a 1.40 ERA with 88 strikeouts in 77 innings pitched with Springfield, the Cardinals promoted Weaver to the Memphis Redbirds on August 3. On August 13, 2016, the Cardinals called Weaver up from Memphis to make his major league debut and start in place of injured starter Michael Wacha against the Chicago Cubs. He struck out his first major league opponent, Dexter Fowler. Weaver pitched four innings, giving up two runs, four hits, three walks and three strikeouts for no decision in an eventual 8–4 win. Weaver spent the remainder of the season with St. Louis. After the season, MLB Pipeline named him the Cardinals 2016 Minor League Pitcher of the Year due to his success with the Springfield Cardinals, where he posted a 6–3 record and 1.40 ERA with 88 strikeouts in 77 innings pitched. The Cardinals also named Weaver their 2016 Minor League Pitcher of the Year. In nine games for St. Louis, he pitched to a 1–4 record and 5.70 ERA. Weaver began his 2017 season back in Memphis, where he earned the title of Pacific Coast LeaguePlayer of the Month after posting a 2.19 ERA in 37 innings for the month of May. He was recalled and optioned multiple times during the season before he was recalled for the remainder of the season on August 17. In 15 starts for Memphis, Weaver compiled a 10–2 record and 2.55 ERA and in 13 games for the Cardinals he pitched to a 7–2 record and 3.88 ERA. Weaver began 2018 with St. Louis as a member of their starting rotation, but was moved to the bullpen in mid-August after compiling a 6–11 record with a 4.67 ERA in 24 starts. He finished the 2018 season with a 7–11 record, a 4.95 ERA, and a 1.50 WHIP in thirty games.
Arizona Diamondbacks
On December 5, 2018, the Cardinals traded Weaver, Carson Kelly, Andy Young, and a draft pick to the Arizona Diamondbacks in exchange for Paul Goldschmidt. He appeared in just 12 games, averaging a 2.94 ERA with 69 strikeouts in innings.