Answer: Prevent Fraud
You may not have paid much attention to it, but along the edges of many U.S. coins like the dime, quarter, and half dollar there are tiny little ridges (formally known as coin “reeds”). These reeds are present on today’s coins as a matter of tradition but, historically, served a very important purpose.
Found on U.S. coins and other currencies around the world, reeding on the edge of coins was intended to prevent currency fraud via coin shaving (and increase the difficulty in counterfeiting them). While today’s coins are made of inexpensive metals, U.S. dimes, quarters, half dollars, and dollar coins used to contain silver–unscrupulous people would use tools to shave tiny bits of silver off the edges of coins before spending them. In the process, they devalued the coins while keeping some of the precious metal for themselves. Reeding is a very simple but effective protection against such fraud because it is immediately apparent if the coin has been shaved.
The reason that all U.S. coins don’t feature reeding is because even a century or more ago, the metals found in pennies and nickels, for example, weren’t precious enough to merit the attention of coin shavers.
Today the reeding is kept on coins, even the newly designed U.S. state themed quarters, as a matter of tradition.