Yes, MSL's Mastcams can focus at a range of distances. But, as with Pancam, the foremost desire is to provide good focus for Mars. The Pancams have a wide field of view; the Mastcams do not have such a wide FOV. So, do not expect perfect focus on the cal target ("sundial")--but do expect very good pictures of that and everything else.
FWIW, having the cal targets be in focus for Pancam would have required either (a) a much larger depth of field, with a side effect of much noisier images (especially in blue, green, and 1-micron filter); or (
having the horizon--and anything past, a few m--be out of focus instead. Everything is a trade (like ineffectual solar panel fans vs. a science payload). The Pancams (like IMP and SSI) are set at their hyperfocal position, such that "infinity" is at one end of the depth of field, the other end is somewhere around 2-3 m, and best focus is in between (like 5m or so).