com awk
:
awk '/^S-/{s=s":"$1;next}s{print s}{s=$0}END{print s}' file
SID_1:S-1-2-12-347289564783285475
SID_2:S-1-2-12-312478290434839212:S-1-2-12-312748912347723432:S-1-2-12-123475184123489632
SID_3
SID_4:S-1-2-12-384721849326143123:S-1-2-12-324624783246712332
SID_5
SID_6