Because of the cross His mother lost a son. That might be very sad, but because she lost this Son, she gained eternal life, just as every person who comes to Him gains salvation because of what He did on the cross.
But beyond all this, our Lord had compassion on the temporal needs (and heartbreak) of His mother.
He directed the disciple "whom He loved"
to take His mother as his own mother; which he did, taking her home with him from that very hour.
How comforting it is to know that our Lord is concerned and compassionate about our very temporary earthly needs.