In both Britain and America, ‘crack’ could mean good or excellent – and to boast or even make a joke (wisecrack).
While ‘crack unit’ or ‘crack regiment’ is a little archaic nowadays, we still talk of something as not being all it’s ‘cracked up’ to be.
In the martial sense, the word ‘crack’ dates to around the 1830s. William Makepeace Thackeray’s short story The Fatal Boots (1839) contains possibly the first printed use of the term ‘crack shot’. The onomatopoeic connections between shooting and cracking noises are obvious. It might be – and this is just my theory – that it became popular in the 1830s to 1840s due to the newfangled percussion caps on firearms, which would have made more of a cracking noise than flintlock weapons.
From the same time you find the first widespread literary and newspaper references to ‘crack regiments’ of the army. Initially, this seems to have meant regiments officered by wealthy, fashionable young aristocrats – so ‘crack’ in the sense of boastful or swaggering. It was a little later that it was taken to mean an excellent fighting unit.