Both share a general sense of discarding.
To get rid of something or someone is essentially to throw it (or them) away.
To annul means to cancel, in such a way that whatever is annulled is assumed never to have existed at all.
"To get rid of" is common English. "To annul" is definitely somewhat formal, though not excessively so.
There is no etymological connection between the two.
Student or Learner