What happens if a creature falls into the space of another creature?
A creature falls into the space of another creature.
Where does B end this turn?
In your description, A dispel's (let's say, with an anti-magic field), so it's A's turn. During A's turn, B falls. This is not B "ending B's movement". Falling is not movement, per se, and thus the rule about where you can end your movement covers your choice of movement. In the case of falling, you land wherever the DM tells you that you landed.
Which conditions do A and B have at the end of the turn? Helpless, grappling, prone, ...?
They cannot share space.
While it is true that
Two creatures less than two size categories apart cannot occupy
the same spaces in combat except under special circumstances (for
example, when grappling, riding a mount, or if one is unconscious
Multiple medium creatures can occupy the same same square, they just can't fight effectively doing so and can't choose to end their movement (in combat) in an occupied square (other than a handful of specific exceptions; grappling, falling prone after a failed Bull Rush or Overrun).
However, there isn't any direct guidance for multiple creatures occupying the same square while fighting. The rules try hard to prevent this from happening, but certainly circumstances may lead to it, like the one you describe.
When this situation has occurred in games I've run, where both creatures are occupying the same square at the start of the next turn, I've always used squeezing, as it seems the most appropriate;
while squeezed in a narrow space you take a -4 penalty on attack rolls and a -4 penalty to AC
Although there's nothing in the rules indicating you are prone after a fall, it's a reasonable DM ruling and one could argue that's what "fall" means. It would be a bit unfair for a creature untrained in Jump to fall prone after an intentional jump, but then be standing after an accidental fall.
If neither creature is helpless but one is prone (but not dead or unconscious), squeezing would still apply, but so would any modifiers for prone
An attacker who is prone has a -4 penalty on melee attack rolls and cannot use a ranged weapon (except for a crossbow). A defender who is prone gains a +4 bonus to Armor Class against ranged attacks, but takes a -4 penalty to AC against melee attacks.
If a prone creature stands up, they are taking a move action, but not moving any distance, so the rule about being unable to end your movement in an occupied square would not apply. (This would be like erroneously restricting a player from taking a 5-foot-step if they had picked up an item or opened a door, since these are move actions that don't actually involve moving any distance.)