Foreign keys are only supported with the InnoDB storage engine for MySQL, but free hosting only supports MyISAM.
According to the documentation:
For storage engines that do not support foreign keys (such as
MyISAM), MySQL Server parses and ignores foreign key specifications.
I guess that last part is why you didn’t get an error.