Just to question the premise for a minute:
earth is protected by a magical defense shield known as the Sanctum
Is that what it is? I thought there were three Sanctums (in New York, London, and Hong Kong), physical locations from which the Sorcerer Supreme and Friends did their protection work; rather than there being a field surrounding the whole planet.
Can the Black Order travel to and from earth...?
It sure seems like they can. In Doctor Strange, Wong explains that the Sanctums and their sorcerers defend against incursions from other dimensions, rather than incursions from space. (We see the Mirror Dimension, and Dormammu's Dark Dimension, in the movie.)
Several other beings have also previously reached earth from space just fine:
- The Bifrost Bridge and other Asgardian technologies in various Thor and Avengers movies
- The Space Stone’s portals in Avengers
- Yondu’s ship in Guardians of the Galaxy
- Ego in Guardians of the Galaxy Vol. 2
- Various Kree and Skrulls (and at least one Flerken) in Captain Marvel
In Infinity War, the Bifrost even smashes straight through a window in the New York Sanctum itself to get
Hulk Puny Banner a seat at the exposition conference table.