From the Super Mario Wiki
Magnet Platforms are a type of platform that made their first and only appearance in Yoshi's Island DS. They are flat, metallic, and have a magnet symbol on them. When first found, they are usually high out of the Yoshi's reach. In order to bring them down, they need to use Baby Wario's Magnet. As made of metal, they'll be attracted downwards, allowing Yoshi and Baby Wario to access it. When the magnet is above or out of range, the platform will buoy back in position, much like a spring. The player can use this to launch Yoshi higher in the air - as long as they can time the jump correctly. The main use for Magnet Platforms is to gain access to regions that Yoshi couldn't reach any other way.