If they're not healed within a set period of time, or when the player travels beyond a certain distance, they will leave and return to their last used home base. If incapacitated, they will automatically heal after combat ends.
The game has a number of temporary companions that will only be available during certain quests. Steal Owned Items (may upgrade to Hack or Lockpick)