They were originally drawn in Spain's group. Whether there's a Uefa rule about contested border or whether they just realised 'uh oh, that could be dodgy', they were moved to Germany's group.
Gibraltar-moves-group-in-Euro-2016-qualifiers-draw-over-political-tensions