Transcriptions from Cambridge American English Dictionary
Both the words' IPA transcriptions have an /æ/ symbol. Do those two /æ/s sound the same?
Are they both short or long?
Is /æ/ sound the same length in all the words?
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It only takes a minute to sign up.Sign up to join this community
In most varieties of General American these words use the same phoneme, /æ/.
However the /æ/ in sag and the /æ/ in slant are different. The /æ/ in slant will be nasalised. It will also be shorter than the /æ/ in sag.
In General American both these words use the vowel /æ/. [Some other varieties of English use different vowels in each word. For example, Southern Standard British English uses /æ/ for sag and /ɑ:/ for slant].
The Original Poster asks three questions:
1. Are these two sounds the same?
Although the vowels used in sag and slant will both be recognised as the same phoneme by listeners, they will have substantially different qualities.
Probably the most important difference will be that in the /æ/ in sag, the air is likely to leave almost entirely through the mouth for the duration of the vowel. In the word slant the velum (the little flap of skin hanging down from the back of your mouth) will start to prepare for the nasal sound, /n/, during the vowel stage. It will lower, allowing the air to escape through the nasal cavity. As the air passes through the cavity it will give the vowel a characteristic metally twang that we recognise as nasalisation.
If we recorded someone saying the word slat, for example, and then the word slant, we could play back just the beginnings of the words without the final consonants and a listener would recognise which word was being said. The nasal quality of the vowel would tell them, for example, that this word was slant, not slat.
2. Are they both short or long?
For a so-called 'lax' vowel, the vowel /æ/ is quite long. This is probably because the articulation requires quite big movements of the mouth. The lips need to stretch quite wide and the jaw needs to drop quite low.
However, the actual length of this vowel will be significantly different in the words sag and slant. A normal, canonical /t/ is unvoiced (the technical term is that it is a fortis consonant). When unvoiced/fortis consonants occur at the end of a syllable, they have a strange effect. They make the preceding vowel and any other voiced sounds much shorter. So the vowel in slant may be up to 50% shorter than the vowel in sag - which ends with a notionally voiced /g/. (The technical term for consonants which are notionally voiced is lenis)
This shortening of vowels before voiceless consonants is known as pre-fortis clipping.
3. Is /æ/ sound the same length in all words?
Apart from pre-fortis clipping there are in fact several other factors which can affect the length of a vowel. One of the most important of these is rhythmic clipping. The more syllables after the main stress in a word, the shorter that stressed syllable will be. So the /mæn/ in the word manager has a much shorter vowel than the /mæn/ in the word man.
Another factor that could affect the length of the vowel is whether it is the nuclear syllable in the sentence (whether it has the main musical stress). The nucleus of a sentence may be much longer than the other syllables depending on the intonation.
Advice to learners
It is not a good idea to try and adjust the length of your vowels to take into account complex factors such as prefortis clipping, for example. Pre-fortis clipping occurs crosslinguistically and you will automatically produce a shorter vowel before a fortis consonant without trying. It's much more helpful to get a feel for the comparative length of a vowel in relation to other vowels, in my experience.
In many speakers in the Midwest and West (particularly the Upper Midwest and the Pacific Northwest), the vowel /æ/ in sag, slag, bag, tag, and so on, is diphthongized1. It can be the same as the /eɪ/ in vague, or it can be pronounced similarly to the way Australians pronounce mate /mæɪt/. See this dialect blog entry.
1It is also diphthongized in sang, hang, rank, blank, and so on. But I believe that this pronunciation is so widespread that most Americans don't notice it.
The two sounds are the same phoneme: no two words are distinguished by using one sound rather than the other. What exactly a given /æ/ will sound like depends on its phonological context, as well as the speaker’s dialect.
As with snowflakes, no two instances of a phoneme are exactly alike; the exact sound of a given phoneme depends in part on the surrounding sounds. As Araucaria has pointed out, some of these differences in pronunciation are automatic, such as nasality and length. Such adjustments follow rules that exist across multiple languages. It’s completely normal for a vowel to receive some nasal coloration from a following nasal consonant; you don’t need a language-specific rule for that, and hardly anyone except a linguist would notice it. You shouldn’t try to consciously adjust your pronunciation to account for such differences.
However, some varieties of English (or any language) have very distinct allophones used in specific contexts. Dialect-specific allophones are not necessarily automatic, and you may want to be consciously aware of them. Taking our specific example: many dialects pronounce /æ/ as a diphthong in very specific contexts. Exactly which contexts these are is a matter of regional variety. In my own Mid-Atlantic variety, I pronounce the phoneme as [eə] before the nasal consonants /n/ and /m/ – but not /ŋ/. For me, this only happens in closed syllables; for example, I pronounce Ann as [eən] but Anna as [ˈæ.nə].
 It really is a marvelous thing, the ability of humans to categorize speech sounds as phonemes! Sounds come out of our mouths (or signs from our hands) in continuous streams, yet we automatically and unconsciously split up the stream into discrete phonemes. Phonemes are abstractions; they don’t exist in time and space, and yet every day we rely on their existence. Each instance of each phoneme is unique and colored by the surrounding sounds (or signs), and yet we know right away that a given sound is, say, an /æ/ and nothing else.
 See Pronunciation of English: /æ/-tensing on Wikipedia