It's possible, but so unlikely that it's not a practical concern for retail copies.
A major publisher shipping malware would be committing commercial suicide. The reputational damage and the legal exposure are enormous, and the copies go through certification and QA before they reach a disc. The scenario does happen in theory; in practice, the risk is negligible.
Where the risk is real is elsewhere. Downloads from unofficial sources are a different matter entirely — repackaged installers are a standard malware vector, and even a legitimate download portal can serve you something unwanted through its own ad network or download wrapper.
The sensible precautions are ordinary ones: keep an up-to-date virus scanner, buy from recognised storefronts, and be wary of any site offering a paid game for nothing.