DISCLAIMER - If this is a life-threatening emergency, please call the Fuel Ratscall the Fuel Rats. If you are a Fuel Rat, please seek out supplemental practical training in the #ratchat channel of IRC.
There are a few methods to handle this situation, depending on the precise fuel situation.
First and foremost, if your wingmate is not completely out of fuel, they can perform a supercruise hop.
Have your wingmate activate thrusters and frame shift drive, jump to supercruise, fly about 5 LS away from the star, and drop back into normal space. This should get them well clear of the exclusion zone, and should allow you to navlock to them.
You should disable your navlock first though, and keep it disabled until your wingmate has dropped into normal space, as navlock doesn't behave well when it tries to drop at the same time (you will end up around 30km away if you don't do this).
If your wingmate is completely out of fuel, and running on emergency oxygen, things get more complex, as it is not possible for them to perform a supercruise hop. In this situation, you will need to perform advanced maneuvers in order to reach your wingmate, and you will need to perform them quickly. One such maneuver is known to rats as the tactical faceplant (TFP).
Disable navlock and approach the star on the side that your wingmate is on. Line your ship up such that their beacon and the center of the star (notated by the little targeting ring on the star) are in line as best as you can. Accelerate a little bit towards the star, and decelerate to 30 km/s. Continue towards the star until you are automatically dropped to regular space.
If you have done everything right, you should be instanced with your wingmate, though they may be several kilometers away. Boost towards them, ready to fire a limpet as soon as you are in range, and hope you make it before their emergency oxygen timer runs out. If they have materials to synthesize more emergency oxygen, instruct them to do so before their timer reaches 30 seconds, as synthesis takes some time.
This is a good tutorial on how to perform a TFP, though nothing beats practice.