You cannot cast shield without a free hand.
Shield has somatic components, and the rules for somatic components say:
Spellcasting gestures might include a forceful gesticulation or an intricate set of gestures. If a spell requires a somatic component, the caster must have free use of at least one hand to perform these gestures.
Without Warcaster, you must free up one of your hands somehow in order to cast shield, which have you have observed, probably means dropping your sword.
A generous (evil?) DM may allow you to drop your sword off-turn.
This answer cites an unofficial tweet from rules designer Jeremy Crawford that states that dropping a weapon is not intended to take any action. There are no rules for dropping a weapon, so a generous DM may rule that you can drop your sword to cast shield. But it is up to the DM to allow this or not.
As NautArch mentioned in the comments, this is probably a terrible idea since your enemy can pick up your sword. But maybe this isn't too big of a deal - if it is your weapon bond sword you can summon your sword back to your hand next turn, albeit at the cost of a bonus action.