Course rating tells scratch golfers how difficult the course will be; slope rating tells bogey golfers how difficult it will be.
To put it another way: USGA Course Rating tells the best golfers how hard a golf course actually plays; USGA Slope Rating indicates how much harder the course plays for "regular" (meaning not among the best) golfers.
Like course rating, slope rating is calculated for each set of tees on a course, and a course may have a separate slope rating for certain tees for women golfers.
The most important role of slope is leveling the playing field for players of different skill levels. For example, let's say Player A and Player B average 85 strokes each for 18 holes. But Player A's average is established on a very difficult course (say, a slope rating of 145), while Player B's average is established on a very easy course (say, a slope rating of 95). If handicaps were simply estimates of golfers' average scores, then these two players would have the same handicap index. But Player A is clearly the better golfer, and in a match between the two Player B would clearly need some strokes.
Slope rating allows the handicap index to reflect these factors. Because he plays on a course with a higher slope rating, Player A's handicap index will be lower than Player B's (when it is calculated using the slope ratings), despite the fact that they both average scores of 85. So when A and B get together to play, B will get those extra strokes he needs.
Slope is primarily used in the United States, but golf associations in other countries are beginning to adopt slope or similar systems.