The 9th level spell "foresight" says that the spell immediately ends if you cast it on another target before the duration is up. However, the duration is 8 hours, and while I get that you could cast it before the duration was up using the elven 4 hour rest or something like that, is there any way to cast any official 9th level spell without taking a long rest?
Provided you obtain enough of them and have enough time to cast them all, using 9th level spell scrolls would allow one to cast a lot of 9th level spells without a long rest.
The DMG has rules for granting epic boons (starting on page 231) that include:
Boon of High Magic
You gain one 9th-level spell slot, provided that you already have one.
Boon of spell recall
You can cast any spell you know or have prepared without expending a spell slot. Once you do so, you can't use this boon again until you finish a long rest.
Either of these boons would allow one to cast Foresight (or another 9th level spell) twice before taking a long rest.
Monsters do not have the same restrictions as player characters and it is also possible for them to have more than one 9th level spell slot. An example of this in published adventures is (spoilers):
Acererak from Tomb of Anihilation
1. Suggested by NautArch
A number of magic items can let you do this
I'm not going to go full detail on, the key is all of these let the user (that's you good citizen) cast a 9th level spell without spending a spell slot. Yes, the list is quite legendary item/artifact heavy. (Numbers in parenthesis give page number for the Dungeon Master's Guide.)
9th level spell scrolls obviously let you cast whatever 9th level spell was inscribed in them.
Candle of Invocation (157) and Cubic Gate (160) both allow the casting of gate.
Luck Blade (179), Ring of Three Wishes (193), and the Moon card from Deck of Many Things (162) let's you cast wish. Also, if you have both the Eye and Hand of Vecna (224)(no downsides, promise) you can cast wish once per 30 days.
Wand of Orcus (227) lets you cast power word kill. I would recommend being Orcus or having his blessing, then it only cost you 2 of its 7 charges.
Wand of Fireballs (210) and Wand of Lighting bolt (211) allow you to, by spending all of the charges at once, to cast fire ball and lightning bolt as 9th level spells respectively.
Tome of the Stilled Tongue (208) lets cast any spell you have written in it for free as a bonus action. Only downside is Vecna is writing notes in your spellbook, but I'm sure those are notes of encouragements.
Book of Exalted Deeds (222) has the neat effect of making all your Cleric and Paladin spells count as one level higher. Thus you can cast a 8th level Cleric spell as a 9th level spell.
Boon of High Magic (232) gives you a second 9th level spell slot, which lets you cast any 9th level spell you have prepared.
Boon of Spell Recall (232) lets you cast a prepared spell without expending a spell slot.