To bring Fantina back to her Gym in Hearthome City, first defeat Roark, Gardenia, Maylene, and Crasher Wake. After that, return to Hearthome City and talk to Fantina outside the Contest Hall. If you already spoke to her there earlier, she may already be back in the Gym.