To answer this question we must distinguish between rarity and scarcity. Scarcity has a relationship to value because we call essential goods scarce when they are in short supply. This causes the item to have more value because its price is inflated in the marketplace, due to its scarcity. The prime driver of the increase in (economic) value is the relationships between 1. the item being seen as essential 2. the item being in short supply and 3. the population having the money to pay more (the relationship in poor communities may not apply because people may simply not have the money and have poor health etc instead).
Rarity does not have the same broad appeal. Today, you wouldn't say oil or wheat are rare; you would say they are scarce if they are in very short supply. Rarity is related to value in niche markets only. For example, the original version of a popular piece of art would be considered rare or even one-of-a-kind and it's value would likely go up but only among a relatively small group of people. we could continue this discussion by asking what value is, whether or not value within a capitalist society can be understood (primarily) as anything other than financial.
What is the relationship between rarity and value? (Philosophy is fun to discuss!)