I wonder if it can harm my website if I have on it links to some websites that were penalized by Google? (even if I've made these links nofollow)
I don't think that outgoing links are bad for SEO, but links to penalized websites may be a problem, follow or no follow. Why are you linking to websites that have been penalized? If it's within the same niche as yours and it's a legitament link, I wouldn't worry about it.
An outbound link to a website which has a Google penalty will not result in any negative action to your own site. Furthermore, to those who think all outbound links are bad for SEO- that's not correct. You don't want to make your website a dead end to the search engine spiders- linking out to related websites (especially those with authority) can be extremely beneficial. WebDev
Just remember what google preaches: "quality content" Do you think linking to a bad site helps? mmm maybe not. At the same time google is not perfect. Google Is not human. He can not tell accurately if it helps you audience. If you think you can have your content shared through the social places maybe you can beat the negative effect from the bad link. (I doubt it).
I think this is something you want to avoid these days with the last Google updates. Google has become more complicated thus avoiding things that are problematic could be a safe route to take.