While it's never been explicitly addressed in canon, yes, observation and extrapolation suggests that it should almost certainly be possible with the help of magic.
Species-swapping and merging magic is well within Twilight's grasp, and she's used it to create Flutterbat as well as pony-Breezies. She has even used magic to turn her parents into cacti and a frog into a (living) orange. The necessary physiological restructuring is "easy". Or rather, any advanced unicorn could do it. You don't run into energy-limitations.
As for the specifics of gender-bender spells, we know magic is a science, and we know from Magic Duel that at least one sex-change spell exists (even if the spell itself isn't actually used). Nothing prevents the spell from existing, there's no strange magical interaction (like how Twilight can't turn an apple into an orange despite her best efforts).
The only thing we can't properly account for is duration. Unicorn spells are always limited in duration, lasting only a few hours or a day at most. In canon, a unicorn can cast a spell and trasnform a mare into a stallion (or just give her a futa penis, I guess), and the mare can then proceed to have sex and inseminate another mare.
But what happens then, when the duration of the spell runs out? The mare turns back, but what about the sperm she ejaculated inside another mare? Does it simply cease to exist? Or does it somehow remain functional regardless and a child is actually spawned?
If the hard limits on unicorn magic apply, there are still two saving graces, one in the form of alicorn magic, the other in alchemy, both seem capable of producing permanent effects.
Possibly every advanced unicorn can help two lesbian have a foal with a spell.
Possibly advanced alchemists like Zecora can help two lesbians have a foal with a potion.
Almost certainly advanced alicorns can help two lesbians have a foal using modified unicorn spells and alicorn magic. Luna and Twilight, possibly Cadance.