When Carnehan remarks of himself and Dravot having to fight through the Khyber Pass under "Bob" Roberts he is referring to the Second Anglo-Afghan War of 1878-1880 and to General Frederick Roberts, 1st Earl Roberts.
The film inaccurately has Carnehan referring to himself as a "gunnery sergeant"; the correct rank for this time is that of colour sergeant.