A side-effect is when an operation has an effect on a variable/object that is outside the intended usage.
It can happen when you make a call to a complex function that has a side-effect of altering some global variable, even though that was not the reason you called it (maybe you called it to extract something from a database).
I admit I'm having trouble coming up with a simple example that doesn't look totally contrived, and examples from stuff I've worked on are waaaay too long to post here (and since it's work related, I probably shouldn't anyway).
One example I've seen (a while ago) was a function that opened a database connection if the connection was in a closed state. The problem was that it was supposed to close the connection at the end of the function, but the developer forgot to add that code. So here, there was an unintended side effect: calling a procedure was supposed to only do a query and the side effect was that the connection remained open and if the function was called twice in a row, an error would be raised saying the connection was already open.
Ok, so since everyone's giving examples now, I think I will too ;)
/*code is PL/SQL-styled pseudo-code because that's what's on my mind right now*/
g_some_global int := 0; --define a globally accessible variable somewhere.
function do_task_x(in_a in number) is
begin
b := calculate_magic(in_a);
if b mod 2 == 0 then
g_some_global := g_some_global + b;
end if;
return (b * 2.3);
end;
The function do_task_x has a primary effect of returning the result of some calculations, and a side effect of possibly modifying a global variable.
Of course, which is the primary and which is the side effect could be open to interpretation and might depend on actual usage. If I call this function for the purpose of modifying the global and I discard the returned value than I'd say that modifying the global is the primary effect.