You can swap it but it will most likely not work and if it works your system will be unstable with regular kernel panics (crashes). Macs are picky about their ram speed. If you have the memory you can just try and do the swap, it will not hurt your system (but you might want to make a back up just to be sure). If the system works then yay and if it does not then swap the memory back.
note, If the memory is the same size i would not bother since there is no gained advantage of using different memory then.
Hope this helps!