Selenium will not be able to take screenshot of an unhandelled Alert. If you want screenshot for debugging, you can try Robot to capture screenshot.
BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(image, "png", new File("path\\to\\screenshot.png"));
But problem with above code is that, you will not be able to use on remote machine and you can not execute tests in background.
You start your tests, keep your browser on top of all other windows and once exception is caught, you can use above code to capture screenshot.
Let me know your views in the comment.