Laws which retroactively criminalise behaviour are expressly forbidden under Article 7 of the European Convention on Human Rights [1] but merely ex post facto law (which may presumably make something legal retroactively) is merely "frowned upon" in the UK [2], because the doctrine of parliamentary sovereignty (i.e. parliament can do what it likes) takes precedence.
[1] http://en.wikipedia.org/wiki/Article_7_of_the_European_Conve...
[2] http://en.wikipedia.org/wiki/Ex_post_facto_law#United_Kingdo...