If the games are coming to NX, Game Freak themselves will develop the port. I don't see a third party or even another Nintendo studio porting the game to another system. While I think an NX version is more likely to happen now than when BW were announced, GF would have to handle both versions.
If S&M end up being 3DS only, then it makes me wonder what the future of Gen 7 will be. Will the next Gen 7 game (be it D&P remakes, S&M sequels, S&M third version, etc) also be 3DS for compatibility purposes so they don't break the generation in half? Will we have another BW->XY situation with Gen 7 being released on 3DS even if NX is already out and then Gen 8 arriving late in NX's life? And if S&M end up being 3DS&NX, will the next games also be released for 3DS or will they drop its support and be NX only?