Sharing health in itself may not be completely trivial thing because the NPCs can have different debuffs applied to them and both in practice need to keep a separate health pool.
You should try different approaches for where you keep the actual health they have or how you manage what is the real health of the NPCs.
Here is one example:
You need to create the NPCs with the same health.
Then make an CreatureScript for them in C++.
Then in the script you should make the creatures know each other in one way or another. For example by storing the guids in the instance script or by making the creatures know each other's database guids
or by making them know each other's entries so they can make a search etc etc etc.
Then use the damage hook: void OnDamage(Unit* /*attacker*/, Unit* /*victim*/, uint32& /*damage*/) { }
and in it you can search for the NPCs and damage both of them with the given damage. Also it might be a good idea to do something like:
A, B = GetCreatures()
A
amage(damage)
B
amage(damage)
hp = std::min(A:GetHealth(), B:GetHealth())
A:SetHealth(hp)
B:SetHealth(hp)
Or similar to ensure they have the same health. - Note that Im unsure how such would work when one of the NPCs dies for example.