Good answers about the deterioration of the wheels, but no explanation on the purpose of the morse code.
The three letters of the code, JPL, stand for Jet Propulsion Laboratory (Pasadena, California), which is the lab which manages the rover mission for NASA.
Moreover, the morse code track is univocally recognised by the visual-odometry systems of Curiosity. This recognition is used to judge the distance traveled.
What about a more traditional odometer?
In the comments, Darrel Hoffman rightfully observed that instead one could count wheels rotation to keep track of the distance traveled. My guess is that NASA does both.
In situations like that, you want as much as information as possible, with the minimum resources as possible. It is not important if the information is incomplete. Let's take specifically this case as an example.
You count the wheels rotation, and the system says that the robot traveled say 100 meters. The system cannot say if the wheel slipped or actually traveled. But now the information provided by the camera comes into play. Not only one can obtain that the distance traveled was 50 meters and not 100, but you have now another information: you now know that in that particular place, the wheels are prone to slip (new information about the terrain). That is, you have a new information by crossing two potentially incomplete information.
Moreover, Curiosity must have the camera to take pictures and shot videos. So with the mechanism of the morse code (which does not occupy space and does not consume any energy), and the very same camera, you can collect further information with no extra equipment.
The key is: the more information the better, even if the information are not absolutely accurate.
Official note from NASA
As commented by Freddie R, an official note from NASA about the morse code here:
Rover Leaves Tracks in Morse Code
The note confirms what I guessed above:
By measuring its distance relative to dozens of prominent features
like pebbles or shadows on rocks -- or patterns in its tracks -- the
rover can check how much its wheels may have slipped.