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. Surprise Balls are round in shape and float in midair. To use one, the Yoshi must use his tongue on this object, and he will be pulled in and thrust upwards, ending up standing on top of it.