Estimate, which won the Gold Cup at Royal Ascot in 2013 and came second in the same race this year, is a five-year-old filly trained by Sir Michael Stoute.
Initial indications are that the positive test resulted from the consumption of a contaminated feed product, the palace said. The Queen, who cheered the horse on to success at Royal Ascot last year, has been informed of the development.
A statement by John Warren, the Queen's Bloodstock and Racing Advisor, said: "On Thursday July 17 the British Horseracing Authority (BHA) announced that a number of post-race samples, obtained from recent race meetings, had been found to indicate the presence of morphine, which is a prohibited substance on race days. Five horses, under the care of various trainers, were affected.
"I can confirm that one of those horses was Estimate, the five year-old filly trained by Sir Michael Stoute and owned by The Queen. Initial indications are that the positive test resulted from the consumption of a contaminated feed product.
"Sir Michael is working closely with the feed company involved to discover how the product may have become contaminated prior to delivery to his stables.
"As the BHA investigates this matter, including potential links between the different cases, Sir Michael continues to offer his full co-operation. There will be no further comment until the BHA announces its considered findings. Her Majesty has been informed of the situation."