The most common causes are:
Spitting, swallowing, or talking during the irrigation. Because these actions would open Eustachian tube (the connection between nasopharynx and middle ear) when water flows from one nostril to the other through nasopharynx, allowing water the possibility to enter your ear. Therefore, please pause the irrigation when spitting, swallowing, or conversation.
If you blow your nose too hard after irrigation, the remaining water in the nose might be forced into the middle ear through the Eustachian tube as well. If the nose is severely blocked that the saline cannot pass through, the pressure built up inside the nasal cavity will cause headache or even otalgia at the beginning of the irrigation. Stop the irrigation immediately, and compress the nose with warm towel for several minutes to relieve the nasal obstruction. Try nasal irrigation only when the nose is not completely blocked.