On December 14, 2017, Hernández was selected by the Miami Marlins in the 2017 Rule 5 draft. He began the 2018 season on the disabled list with a tooth infection and was activated on May 10. He had been rehabbing with the High-A Jupiter Hammerheads and the Double-A Jacksonville Jumbo Shrimp. He again hit the disabled list on August 24 after suffering a blister on his middle finger, and rehabbed with the Triple-A New Orleans Baby Cakes. He finished his rookie season going 2–7 with a 5.21 ERA in major league innings. He split the 2019 season between Miami and New Orleans, recording a 3–5 record and 5.03 ERA in 21 games for the Marlins.
