If you are doing it in 2D, then you need to write a script that will scale the game object containing your healthbar based on the distance from the camera to the object the health bar is following.