From the Super Mario Wiki
A Surprise Ball (also known as a ! Ball) is a spherical platform that Baby Yoshis use during the events of Yoshi's Story. They are round in shape and float in midair. To use it, the Yoshi must use his tongue on these objects, and they will be pulled in, and thrust upwards, ending up standing on top of it.