From the Super Mario Wiki
Retrieved from "https://www.mariowiki.com/index.php?title=Magnet_Block&oldid=2676213"
Magnet Blocks make their first and only appear in Yoshi's Island DS. They are depicted as large, gray squares with a Magnet symbol on it. There are two possible ways to move the blocks. The first way is simply having a Yoshi push it as if it was a normal block. The second — and most common — way to move one of them is through Baby Wario's Magnet. As they are usually found in corners, the player will need to have Yoshi walk away from the block. In result, the metallic block can attract to Baby Wario's magnet, dragging it along with them. That enables it to be pushed or continue being pulled by the magnet.
Magnet blocks can only be found in levels that Yoshi allies with Baby Wario, which is the second half of World 3 and World 5-8. They are also similar to Magnet Platforms, which appear in the same area as well.