First, put the following function in your functions.php file:
function get_cat_slug($cat_id) {
$cat_id = (int) $cat_id;
$category = &get_category($cat_id);
return $category->slug;
}
Once done, you can call the function as shown below:
<?php echo get_cat_slug(21); ?>
This will display the slug for the category with the ID 21.