Here's an example for a uint8 image:
A = imread('cameraman.tif');
[B bmap] = gray2ind(A,maplength);
C = uint8((maplength-1)/255 * double(A));
You can also just look at how it's done by opening gray2ind.m.
So it appears that it pays no attention to the actual image content either locally or globally. It merely does a crude uniform quantization based on the standard data range defined by the numeric class.
This is in contrast to rgb2ind() which is both more complicated in its available palette reduction methods, but also wrapped up in mex, so figuring out how it works isn't as easy.