From the Super Mario Wiki
Sand Blocks first appear in the game Donkey Kong for the Game Boy. They disappear as soon as Mario walks over them. They do not return afterwards. In one level in Rocky-Valley, walking over Sand Blocks will set a group of Hedgehogs free which are trapped under the Sand Blocks. Another stage in the Tower is only consisting of Sand Blocks.
In Super Mario Sunshine, Sand Blocks appear in Secret Levels. If Mario walks over them, they fall apart. They then reappear after a certain amount of time. Their function is similar to Shrinking Tiles that are later found in Super Mario Galaxy.