Kostyuk was leading 6-2 1-0 when Badosa pulled out with a back problem.
Badosa, the girlfriend of Greek Stefanos Tsitsipas who will renew his battle with Andy Murray later on Friday, missed the French Open due to a spinal stress fracture.
Spain's Badosa was scheduled to play with Tsitsipas in the mixed doubles but that now looks unlikely.
"The injury is the same as I have been struggling the past weeks. It's the stress fracture," Badosa told reporters.
"I tried my best to try to play here, but yesterday when I woke up I already, after my first-round match, felt it again.
"It's a little bit worse. So I will need a few days off and talk to my team and see what I do in the next days and the next weeks."
Kostyuk defeated eighth seed Maria Sakkari in the first round and will hope to continue her run against either 25th seed Madison Keys or Viktorija Golubic.