"Beat it" is a slang phrase the means "go away" or "get out of here." It's usually used when you're in potential trouble and need to escape in a hurry ("Do you hear that? I think the cops are coming! We'd better beat it!") or if someone has become bothersome to you ("You're getting on my nerves, why don't you just beat it.")
In Michael Jackson's song, he's advising that it's better to run away from a fight than to get hurt:
You better run, you better do what you can
Don't wanna see no blood, don't be a macho man
You wanna be tough, better do what you can
So beat it, but you wanna be bad
Just beat it, beat it, beat it, beat it
No one wants to be defeated
Showin' how funky and strong is your fight
It doesn't matter who's wrong or right
Just beat it, beat it