Top seed Halep needed two and a half hours to overcome Slovenian world number 46 Hercog on clay in the Czech capital, blowing six match points in the decider before prevailing in a tie-break.
The second-ranked Halep will meet Barbora Krejcikova in the round of 16.
The reigning Wimbledon and former French Open champion was appearing in her first match on tour since securing her 20th career title at the Dubai Championships in February.
She pulled out of the first post-lockdown WTA tournament in Palermo last week over virus concerns, and is yet to make a final decision whether to play at the US Open later this month.
The tournament in Prague is Halep’s first trip abroad since February, having spent the lockdown in her native Romania.
Organisers of the Czech event have put all players and staff in a single eight-storey hotel reserved for the occasion to reduce the risk of COVID-19 contagion.
Regular temperature checks are a must, just like face masks which the players have to wear unless they are playing, training or eating.