Shitposting comes from someone making a shit post, as in a bad one. If I recall, the difference is if it is purposeful or not.
Shit Post - Bad post that doesn't intend to be bad to a hilarious degree (E.G. the Blacked Waifus thread OP in this board)
Shitpost - Bad post deliberately made to be bad to hilarious effect, either to amuse oneself or others (Derailing a thread by saying something outlandish for laughs)
The common thread is that the post is laughable to some degree.
It's called shitposting because bad people with worse taste who treat the net as srs biznis think that your gold star funposting be it Sneed, Bane, Skitzo, or some other flavor of mental illness or meme, is "of shit quality" because you're having fun and they will never be a real employee.
A really big trend on 4chan back in the day was posting unrealistically comedic greentext stories about shitting. I think the term "shitposting" likely originated from the /b/ tradition of posting about shit.