Get rid of their spaceships
The only way, other than the aliens choosing to have an even fight, to make this even remotely plausible would be to have them lose most of their tech - at the very least all use of their spaceships - around the time of their landing on earth.
Any spaceship capable of interstellar travel, no matter how limited, is a far more potent weapon than anything a medieval society has access to. If they can get, say, ten people to orbit, they can probably just as easily drop a half-ton rock on your capital. Or crush your armies by firing their trusters once or twice. Or do whatever else they like because swords and arrows aren't much of a threat compared to colliding with space rocks at relativistic velocities.
Even if you ignore a spaceship's offensive uses, the humans would need pretty much unlimited teleportation magic (which is also a weapon potent enough to render swords etc. meaningless), otherwise the aliens' logistical and strategic advantage will make them unbeatable. You can't catch them, you can't siege them, you can't defend your crops, livestock or food stores, or infrastructure.
However, take that away from them and the tides might turn:
They probably (used to) rely on their spaceships for almost everything
Let's be real, a foot soldier, even with the fanciest of guns, is not going to be much use in a space battle. Why would the aliens waste valuable cargo space on infantry weapons when they have a gigawatt laser turret on their vessel? Why lug around explosives when you can level a city by pointing your thrusters at them? Better pack more fuel or better food or that redundant life support system they recommend for long voyages.
The only way you would be worse off is if you ran out of fuel, or broke something critical during the landing, or the engine had some weird interaction with the local atmosphere. But that's never gonna happen, right? Right?
Okay, crap, uhm, let's just fire up the fabricator on emergency power to make ourselves some pointy sticks, yes? And pray that the skiff still works, we're gonna need it.