Sure, but poor implementation of it will destroy the design of a game.
I very much like games that let you change the difficulty setting without restarting the game. That way you can choose how difficult you want the game to be, and if you start having a hard time, you don't have to start over the very first level.
Games that automatically change the difficulty, I find frustrating. Games like Oblivion and Final Fantasy 8 take it to the extreme, where you're actually punished for making progress in the game. As your character levels up, so does everything else in the game, making it pointless for the player to bother trying to level up.