Among the rulings that apply to lost property (luqṭa) is that, when the item is insignificant—something to which ordinary people attach no importance—a person may pick it up and take ownership. If, however, the item has value and attracts attention, he may take it only on condition that he record its distinguishing features and announce it in public gatherings for a full year so that the owner can hear of it and, after stating those identifying marks, reclaim it.
If the lost property is found within the Sanctuary (ḥaram)—that is, inside the mile-marker boundaries—it is not permissible to pick it up unless the finder undertakes to keep announcing it until its owner arrives. Outside the ḥaram the ruling is as stated earlier: if the finder notes the item’s distinguishing features and announces it for a year in public places and no one claims it, he may then assume ownership.
As for property found inside the ḥaram, the finder may take it only on the condition that he perpetually announces it and never takes possession of it. This is the difference between lost property inside the ḥaram and that found elsewhere, in accordance with the Prophet’s ﷺ saying about Mecca: “Its lost property is lawful only to the one who publicises it.”
With regard to your case—finding several sponge mattresses on the road between Mecca and Jeddah—the ruling is as follows: if they lay outside the limits of the ḥaram and beyond its boundary markers, you must announce them for one year and may then take ownership. If they were inside the ḥaram, it is not permissible for you to keep them; rather, you must go on announcing them until their owner appears. Otherwise, leave them where they are, for the responsibility would be lifted from you. If you are confident of your own trustworthiness and of fulfilling their Sharīʿah requirements, take them; but if you do not trust yourself or will not comply with the rulings, then leave them, and you will be free of blame. Allah, exalted is He, knows best.