Healing and Repairs usually only offer via special events or at a specific location.  Unless the player is grievously injured or their ship is disabled most places that offer healing/repairs will be able to fully heal/repair.  The cost can vary either by location or can be a standard cost.  Also, given the level of difficulty the layer wants, the cost can also vary based on how much damage was inflicted upon the player.

There are special events that offer to heal/repair players outside of civilization however it is best if players chart a course that enables quick access to civilization if needed.