Is this legal? I mean they aren't uk nationals so they aren't protected by the normal laws. I'd like to know what, if any, laws were broken or whether this is simply an ethical issue.
Almost certainly none at all. The UK intelligence services have a remit for espionage against foreign governments. Domestic targeting...that's another, altogether thornier issue.
I suppose you could say it was an ethical issue, but I can't imagine attendees not being aware that they were probably under surveillance. I would bet the countries caught out were those inexperienced in high-level foreign intelligence. The Guardian article alludes to this somewhat - it says GCHQ managed to "[target] the Turkish finance minister and possibly 15 others in his party", but only "receive reports from an NSA attempt to eavesdrop on the Russian leader". "Attempt" is the operative word here.
It would be incredibly naive for the Russians to go to a G8 conference in the UK and not expect to be bugged - and vice versa, if the conference was in Moscow. It's not as if the spying just stopped when the Cold War ended.
It's embarrassing that it's public, but I highly doubt the countries involved trusted their hosts. Do you really think Russia trusts the UK and the US?