Castle privies were built into walls and odd corners. They were called garderobes. They emptied into middens, or cesspits (or sometimes directly into rivers). Water closets (early flush toilets) were invented in the late 16th Century. Queen Elizabeth had one constructed for herself. They didn't become common until public water systems did, though.
In the meantime, most people continued to use outhouses and chamberpots. In Edinburgh, Scotland, the cry, "Gardyloo!" from an upper window meant that someone was emptying a chamberpot into the street and you should get out of the way. "Gardyloo" is supposedly from French garde l'eau ("watch out for the water"), and may be (for all I know) the source of the British euphemism for toilet, "the loo."
Garderobe in the White Tower |