I believe it derives from the green eyeshades used ages ago by accountants. Wikipedia's writeup of
green eyeshades mentions that they were used by folks doing detail-oriented work over long periods under bright lights. If you think of the stereotypical back-room poker game, with the one bright light over the baize, the need for the dealer visor/eyeshade becomes clearer.
At poker rooms where the lights over the tables are uncommonly bright, I do notice a difference when I wear a hat or visor. But I've never seen an actual dealer wearing one in a casino.