I don't think we can ever be sure it's true, it's a subject of hot debate for those in-the-know re: egyptology. I've only heard about it second hand. The predominate theory of how this came to be is that the researchers involved were careless and somehow contaminated the mummies. Another theory (which seems waaay more crackpot-ish than the assumption of pre-columbian contact between the contacts) is that the compounds were the result of chemical interactions between the plant materials used for preserving the mummy.
"The German research group published their initial findings in 1992. [11] Balabanova, an experienced forensic chemist, used radioimmunoassay and gas chromatography/mass spectrometry (GC/MS) to identify and confirm the presence of cocaine, nicotine and hashish in Egyptian mummies. The remains used in this study included 7 mummified heads (all adults, 2 females, 5 males), 1 single complete adult female and 1 incomplete adult male. All the mummies tested were from the Egyptian Museum, Munich and they had been dated to a period spanning 1070BC – 395AD. Cocaine and hashish were also found in all 9 samples and nicotine was present in all but one of the samples tested.
In February 1993 the group published a second, more comprehensive, paper on their findings in The Lancet [12]. This included their analysis of 72 Peruvian (200 - 1500AD) and 11 Egyptian (1070BC – 395AD) mummies and also skeletal tissue from the Sudan (2 individuals, 5000 - 4000BC and 400 - 1400AD) and South Germany (10 individuals, 2500BC).
Their data (Table 1) showed that cocaine, nicotine and hashish could be identified in samples obtained from some, but not all, of the Peruvian and Egyptian mummies that were tested. They also identified nicotine in the bones of both individuals from the Sudan and in 8 out of 10 of the individuals from the German "Bell" culture. The levels of cocaine discovered in the hair of Peruvian mummies were found to be similar to the levels found in modern day German drug addicts and this would indicate that the degradation of the drug does not occur significantly over time. The Egyptian mummies were found to have approximately 75 times less cocaine than the maximal amounts identified in modern day German drug addicts. "
quick excerpt I found on it.