If those computers have Bluetooth for wireless ones, I don't see why not. You wouldn't be able to use a lot of the special things like multitouch on the magic mouse
The wireless mouse and keyboard for an iMac should, i havent tested it but im 99% sure they are just standard bluetooth devices so they should work fine.