Potions are magic items so they follow the same general rules as other magic items.
From page 135 of the DMG:
Rarity provides a rough measure of an item's power relative to other magic items. Each rarity corresponds to character level, as shown in the Magic Item Rarity table. A character doesn't typically find a rare magic item, for example, until around 5th level. That said, rarity shouldn't get in the way of your campaign's story. If you want a ring of invisibility to fall into the hands of a 1st-level character, so be it. No doubt a great story will arise from that event.
And the Magic Item Rarity Table is on the same page, just below the section I quoted above.
If you're looking to create your own potions with magical effects then you need to look to page 284-285 of the DMG; Creating a New Item. This provides a table of Magic Item Rarity to Max Spell level/Max Bonus inferred and you'll just have to feel it out from there.