The standard behavior of synths, specially when we talk about YAMAHA, is that whenever a sustain pedal, which has been connected to «damper» or «sustain» inputs in the back of the unit, is used, two things happen: first, the sound of the synth is affected by this pedal and second, a MIDI message, specifically a Control change #64 is sent through its midi OUT.
If a cable is connected from this OUT to the MIDI IN connector on another synth, say, the Nord, this.message will arrive along with any MIDI NOTE ON and OFF messages, making this.second keyboard sound along with the first, including the action of the sustain pedal.
This is standard behavior. Some keyboards allow the user to modify this behavior, should they want to do something different.
So, yes, all you have to do is to connect a midi cable from midi out of, say, the YAMAHA synth, to the midi in of the Nord, and you have what you are looking for, provided that both synths are assigned to the same midi channel.
If you don't do the inverse connection, ie from Nord's midi out to YAMAHA midi in, then the sustain pedal connected to the Nord won't affect the YAMAHA.
You can just have only one pedal and connect it to the YAMAHA, in this example, because it will work, whether you play in that synth or in the Nord, as the Controller message related to sustain will still be sent.
Regards