If there is a stud in the areas separating (use a stud finder) a 2 inch finishing nail will fix most or all of the problem. Use a nail set to sink it about 1/16 inch below the surface and fill the hole with spackle. You might still need to caulk as sparky said but if there isn't a nail at every stud the problem could recur. Cut the tip of your caulking tube smaller than you think it needs to be. You want to fill the gap, not round the corner between the baseboard and wall.