When battling is the main source of entertainment, having access to affordable ways to heal is a necessity in the world of Pokémon. That's why Pokémon Centers are a staple of the battle culture in the series. Every town is sure to have one, and best of all, they're free to use. Simply being able to have one of the many Nurse Joys heal your Pokémon helps trainers out so much.
Not every trainer is a winner. Given that it's customary to give a portion of one's money to the victor of a battle, it's safe to assume that the average trainer isn't able to afford potions on a regular basis. Even beyond paying out victors, trainers have to pay for Pokéballs, travel costs and food for themselves and their Pokémon. In the anime, Pokémon Centers have been shown to provide free housing for traveling trainers, but that might not be the case for every Center, so you might have to add accommodations to the list of costs for trainers.
There's also the fact that most trainers start their journeys at 10 years old. They're literal children going out into the world to try and make something of themselves. They're not likely to have saved up much money in that time. As they grow with their Pokemon, they may win battles here and there, but not everyone can make a living through battles alone. Many adults in the series have jobs like construction workers, police officers or scientists. Some of these jobs require degrees or training, which also costs money. Many of these jobs utilize Pokémon like Machamp or Growlithe, who could get also get hurt on the job.
Having access to a Pokémon Center makes things fairer to those trainers and owners who don't have as much money as others. Imagine having to pay every time your Pokémon was injured in a battle or pulled a muscle on the job. The insurance rates would be through the roof. By having access to affordable healthcare, trainers don't have to worry about whether their Pokémon are going to live or die after battles. Everyone has the same chances to raise happy, healthy Pokemon and make sure that they live up to their fullest potential. The rich trainers don't have the upper edge -- every trainer is equal.
Each trainer that uses a Pokémon Center has a chance of doing better with the next battle. Nurse Joy takes great care of all Pokémon that come into her Center, no matter the financial status or the age of the trainer. Without these wonderful nurses, those who couldn't afford to have their entire teams healed would run the risk of their Pokémon never recovering and never being able to challenge another trainer.
Having this one building that everyone can go to makes sure that every trainer has a fair chance of becoming the next Pokémon Master. As for how specifically Nurse Joy gets paid for her services, that's another question entirely.