Full-size M&P mags will lock into a compact and function perfectly, but the mag body will project from the bottom of the grip frame.
If the gap bothers you, aftermarket companies offer sleeve-style rubber adapters to fill the gap; Google "X-grip magazine adapter".
M&P compact mags are too short to lock into the full-size pistols.
The M&P Shield takes a completely different type of magazine from the rest of the M&P lineup. They are not cross-compatible.
Also, the .40S&W and .357Sig magazines are the same, but the 9mm and .45ACP magazines are different, and are caliber-specific.
"Smokey, this is not 'Nam. This is bowling. There are rules... MARK IT ZERO!!" - Walter Sobchak