Using a macbook SSD as a replacement in iMac I have a MacBook Pro (15-inch, 2017) and iMac (Retina 5K, 27-inch, Late 2015)
the Macbook Pro will be disposed for various reasons.
I want to know if it's possible to use the SSD 2To in  MacBook Pro (15-inch, 2017) as a replacement SSD in iMac (Retina 5K, 27-inch, Late 2015) which has currently a 3,12 To fusion drive (128 ssd / 3to hard drive) ?
According to this definitive guide of Apple SSD modules:
https://beetstech.com/blog/apple-proprietary-ssd-ultimate-guide-to-specs-and-upgrades
your iMac can use the 'Generation 5' SSD module that comes in your MBP, even though the iMac originally comes with 'Generation 4'.
Don't forget that if you replace one part of a Fusion Drive, the data on the 'volume' is entirely lost, so make sure you've got a backup before starting. (I'd recommend keeping the hard drive as a separate volume from now on.)
However, if you want to save yourself the bother of opening up the iMac, an external Thunderbolt drive may be just as fast.