The word shit likely developed out of the middle east from the Hebrew word 'שטן' (Sht'n), which is for Satan. This is why it is considered profane and why the phrase 'holy shit', is/ should be considered highly blasphemous. It is likely to have developed into a common term for faeces in humour as 'the work of the devil'. This also is why when something has gone horribly wrong, the terms 'gone to shit' really brings about its relevance.