Directly? No. Unlike a spellcaster living in town to perform a service, items can be imported and traded. It's not at all uncommon in the real world (and most game worlds) for something to be available for sale somewhere that isn't actually made there.
That's the basis of trade, after all.
That said, the two can kind of indirectly follow each other. Larger towns/cities are going to have more people. More people means more (and likely higher level) spellcasters.
More people also usually means more wealth, which means more shops and the ability to afford more expensive items.
You wouldn't expect a backwater town where the highest level person is a level 2 Cleric to stock high level goods, normally. But if that backwater town also happens to be near a frontier that a lot of adventurers frequent, you can expect some enterprising merchant to set up shop and bring in goods to cater to those adventurers.
There are some rules for a normal settlement, although they're not absolutes and GMs are free to customize as they see fit when building a game world. What you see looking at the entries is that as the size of a place goes up, the maximum spell level available goes up, as does the cost of the most expensive items available, the cost below which items are easy to find, the number of items likely available, and the quality of items.
So to look at your specific question, look at at the statistics table to find a settlement that has 2nd level spells (Hamlet). Hamlets have a base limit of 200g and a purchase limit of 1000g. That means that items under 200g are likely to be available (75%) chance, and items between 200 and 1000g have a chance to be available.
Third level potions cost 700g, so based on this they would be in the range of availability in this Hamlet, but not in large quantity. You can see on the next table that in a Hamlet, 1d6 magic items above the limit would be a standard availability. Potions could be in that list, although your GM might just rule that more potions are available or not based on what suits the specific location in the game world.
First level potions would be easy to find in this Hamlet.
Hamlets have a population of 20-60. For reference, third level potions would be easy to find in a small town or up, which has a population of 201-2000 and fourth level spells available.