From the Super Mario Wiki, the Mario encyclopedia
The Baseball is a special item in Paper Mario: The Origami King. It is one of the few items required in a long line of trades. It is found on the lower shelf in the Shuriken Dojo. To earn it, Mario must score exactly twenty-one points during a normal round of shuriken toss. As a reward for doing so, the owner of the dojo gives Mario the baseball, claiming it is signed by him. He explains he was a baseball player at one point, which helped with his shuriken accuracy. He advises Mario to keep it safe in the event it becomes worth a fortune some day.
With the baseball given away, the item on the lower shelf is replaced by a Tail. Mario must take the baseball to the Dry Bones tossing around a Bone and speak with them. One of the Dry Bones asks for the baseball in exchange for the bone - Mario must accept the trade to advance in the story.