In a world without modern banks, secure vaults, or deposit insurance, valuable objects and money could be concealed in the ground for safekeeping, particularly during periods of war or political instability. A hidden cache might remain undiscovered if its owner died, was displaced, or never returned.
Pearls were highly prized luxury goods in the ancient Mediterranean world. A merchant dealing in them represents someone experienced in recognizing quality and value. In the two parables, one person appears to encounter the treasure unexpectedly while the other is actively searching, but both recognize a value great enough to justify selling everything else.