Fernandez, the 2013 National League Rookie of the Year, was 4-2 with a 2.44 ERA before complaining of a sore right elbow during his most recent start, against the Padres on May 9.
After he was diagnosed with a tear in his ulnar collateral ligament, the team doctor recommended the season-ending surgery; Fernandez wanted to speak with his family about options before committing to it.
Fernandez went on the disabled list on Monday, and Anthony DeSclafani was called up to take his turn in the rotation on Wednesday.
The recovery time for the surgery, which will be performed by Dr. Neal ElAttrache, is usually between 12 and 18 months.
Fernandez, who was also named to the NL All-Star team and third in NL Cy Young voting last season, made his big league debut last April 7.
"When he was hurt we worried a lot about him," said Henderson Alvarez. "He's a huge loss for us. I'm sure he will work hard and return better than before."