For dialects that have this (not all English dialects do), the difference in time for the two words is precisely the difference in time for the two vowels.
Perhaps. And perhaps not. Many would elongate or voice ("voice" in the linguistic sense meaning activate the vocal cords) the m in ham - not just the lengthen the a - in a way that they wouldn't when saying hamster, in which they might pronounce the "m" as a glottal stop (the reason why hamster is often misspelled as "hampster") or as a voiceless bilabial consonant.
Regardless, it's a red herring, because vowel length can also refer to "long" vs "short" vowels as in Bake vs. Back. Thats a different, and in my view more common, meaning of vowel length
Elongating the voice is exactly what I mean by an allophonic difference.
As for 'hamster', no one (that I know of) pronounces the /m/ as a glottal stop, although people sometimes epenthesize a voiceless consonant [p] (by devoicing the end of the /m/). Where some English dialects get a glottal stop is for an intervocalic or word-final /t/ (in addition, of course, to the glottal stop in the middle of 'oh-oh' and 'uh-uh'). I've also heard American English speakers glottalize word-final /k/ and sometimes /t/, but a glottalized stop is not the same as a glottal stop.