The morning after pill

How long after having sex could this work? And where could I buy it? Do I have to be 18?