A mechanism by which this could happen:
>A Martian meteorite is a rock that formed on Mars, was ejected from the planet by an impact event, and traversed interplanetary space before landing on Earth as a meteorite.
https://en.wikipedia.org/wiki/Martian_meteorite