A player's defensive rating (typically shortened to DEF in the game) is calculated based on a number of different factors. It is typically a combination of the player's +/- rating, his team's goals against, his team's record and final standing.
Additionally, if a player has received any defensive-related trophies or awards, they will be factored into his defensive rating. All of these factors are used in a formula that considers their time on ice (when available) compared to the league average time on ice for defenders.
Note that some stats, such as +/- and time on ice, are not available for the older players. In these cases, a more simplified formula using the available stats is used.