Most Shimano 10-speed cassettes road cassettes come with a 1mm spacer. It is intended to and should be installed whenever it can fit on the freehub body.
Mountain cassettes never include or use this spacer.
For cassettes that include it, in many instances the small cog overhang past the end of the freehub body will be marginal if the 1mm spacer is left out in an installation where it will fit, potentially causing the lockring to bottom out. It's within possibility for this issue to develop or become noticeable over time, as cassette carriers and freehub bodies can have slight dimensional wear occur, particularly aluminum ones.
In the case of installations where other spacers are present, Mavic being the classic example, it should be installed in addition to the other spacers.
For the tall-spline Shimano 10-specific hubs, i.e. FH-7800 and WH-7800, the spacer will not fit and can be left out.
The spacer also exists to create cassette location interchangeability, i.e. for wheel swaps sans adjustment. In other words, the design of the various hubs and 10-speed cassettes is intended to create the same dimensional relationship between the cassette and the dropout for an 8/9/10 hub with a 10-speed cassette that has its 1mm spacer installed, an FH-7800, an 8/9/10 hub with a Tiagra CS-4700 10-speed cassette (not tall spline compatible and doesn't come with the spacer), an 11-speed hub with the 1.85mm conversion spacer plus a 10-speed cassette with its included 1mm spacer, and a Mavic hub with the 1.8mm spacer for Shimano 8/9/10 cassettes plus a 10-speed cassette with its included 1mm spacer. An 8/9/10 hub hub with a mountain 10 cassette will also put the cogs in the same place, although it probably won't work in the same bike as the road ones.
There may be some instances where leaving the spacer out on an installation where it will fit will create improper contact between the cassette and the shoulder of some freehub bodies. (Some cassette carriers have a lip for the spacer machined out).