Being square is an old term, it means to be, "uncool" - not part of the group - a social reject, not relaxed enough, "too straight edged".
Be there or be square, means, "come along to (the party) or be an unpopular person who never had any fun!".
And it rhymes which always helps :D