No, Sonic & Sega All-Stars Racing was never released for the Nintendo DS. The game launched on Wii, PlayStation 3, Xbox 360, and PC. A separate title, Sonic & Sega All-Stars Racing Transformed, later arrived on the Nintendo 3DS with different gameplay mechanics and an altered character roster.
If you're looking for a Sonic racing experience on a Nintendo handheld, the 3DS version of Transformed is the closest official release.