To repair your ship, you must dock your ship. Your ship will regenerate 1 hit point to all parts per minute. E.g. If you have a damaged Engine, Reactor, and Scanner, your ship will repair 1 hit point to your Engine, Reactor, and Scanner per minute.
To repair a station you require a repair ship. While scanning a station, a repair ship will have the option to repair the station if it's damaged. It requires 100 turns to repair a station. If you are repairing the hull, armor, or dock of a station, the repair ship will repair 100 hit points for 100 turns. If you are repairing any component, the repair ship will repair 5 hit points for every 100 turns.