It varies. Usually they're fine to keep, but you do it at your own risk.
Hacked Pokemon, in general, are caused by modifications with the game programming; so therefore they should be treated a little differently. Sometimes, hacked Pokemon can do different things to each other - some can freeze the game when viewing the summary, some cause screens to blur; etc., but usually these aren't threatening to the save file itself - but the files it uses. So, if you kepr it in your PC Box, for example, it can't really do anything; it's a different story with glitch Pokemon, which most people think are identical to hacked ones. So if they are not used, they can't really do much; but keep them at your own risk. Summing it up:
- If you want to be on the safe side, get rid of it.
- If you want to run a risk but keep a Pokemon, keep it.
The consequences of hacked Pokemon aren't too serious really. Some more so than others however. They can potentially cause permanent damage to the game; e.g. causing an un-releasable spot in the party that can't be moved, for example. These prove harmful, but they are not a serious as glitches which can venture further into the game. Basically it depends on what you actually hack; if you chance the wrong thing, you'll cop something bad back. If you change something minor, you may be able to weasel your way out of a problem. Usually things like Action Replay or ROMs aren't too harmful; I have more trust in them than anything else.
I, myself, would release the hacked Pokemon, whether it be a Bad Egg or an overlevelled Arceus; if you keep it, you are taking a risk.