Showing work you have completed as a freelancer is obviously preferable. Whether you can legally show the work you did for a previous employer will depend on your employment contract and/or whether you signed an NDA. Those things aside, you should be fine.
It's worth bearing in mind that the copyright for each site will be owned either by your previous employer or their client, who can therefore legitimately request you remove the site(s) from your portfolio.
To help avoid that happening there are a few other things you can check:
- Is the work done by your previous employer covered by a clients' NDA? If so avoid listing it, since you are likely also bound by the NDA.
- Is the work on your previous employers website? In this case you're probably fine showing the site and writing about your contributions.
I have personally listed work done for a previous employer without issue, though now I only do so in proposals for which I'm lacking other examples of work.
If you have any doubt about your contract, NDAs, or legal obligations, please consult a legal professional in your jurisdiction — I am not a lawyer.