You can absolutely do away with the magnetics if you're only connecting between two PCBs within the same device. It's actually pretty common when for instance connecting between PCBs on a common backplane, or even between ICs on the same PCB.
Assuming you're not using RJ45 connectors? If you are, they do make them with integrated magnetics that are really not much larger than a plain jack.