The St. Louis Cardinals selected Leahy in the 17th round, with the 513th overall selection, of the 2018 Major League Baseball draft.[2] He made his professional debut with the rookie–level Johnson City Cardinals, pitching to a 5.52 ERA across 13 contests.[3] Leahy split the 2019 season between the Single–A Peoria Chiefs, High–A Palm Beach Cardinals, and Double–A Springfield Cardinals. In 23 games (22 starts) between the three affiliates, he accumulated a 5–13 record and 3.73 ERA with 102 strikeouts in 123.0 innings pitched.[4] He did not play in a game in 2020 due to the cancellation of the minor league season because of the COVID-19 pandemic.[5]
In 2021, Leahy appeared in 25 games and struggling to an 0–8 record and 8.20 ERA with 63 strikeouts across 86+2⁄3 innings pitched.[6] In 2022, Leahy spent time with Springfield for a third season, also appearing in one game for the Triple–A Memphis Redbirds. In 28 games (26 starts) for Springfield, he pitched to a 10–7 record and 5.29 ERA with a career–high 146 strikeouts across 144+2⁄3 innings of work.[7] Leahy began the 2023 season back with Triple-A Memphis, pitching in 28 games and recording a 4.06 ERA with 51 strikeouts in 51 innings pitched.[8]
On July 6, 2023, Leahy was selected to the 40-man roster and promoted to the major leagues for the first time.[9] In 3 games for St. Louis, he allowed four runs on four hits and five walks with two strikeouts in 1+2⁄3 innings pitched. Following the season on October 26, Leahy was removed from the 40–man roster and sent outright to Triple–A Memphis.[10]
On April 30, 2024, the Cardinals selected Leahy's contract, adding him back to the major league roster.[11]