"get your head together" is an idiom and is a command for you to start thinking straight. If your "head" or brain is in many pieces and separated, you're not thinking straight, so "getting your head together" would mean thinking straight and having a mind that is focused.