You basically need to find out if the two cards have the same interface - if
both cards are, say, minipci-e then AFIK there should be no problems at all.
If computer A has a minipci slot, then you want be able to insert the
minipci-e taken from computer B in there..
You can use an extension to transform a minipci-e half-size in a full size.
Most computers of the last 10 years have either a half-size or a full-size
minpci-e, so yeah, there is a huge chance you'll be able to replace them.
Only thing you may need is an extension, which you can buy for 2 bucks
https://www.thinkpenguin.com/gnu-linux/mini-pci-mini-pci-e-mini-pci-e-half-height-guide-laptop-wifi-cards
cheers