Q:

Why did Voevodsky consider categories "posets in the next dimension", and groupoids the correct generalisation of sets?

Earlier today, I stumbled upon this article written by V. Voevodsky about the "philosophy" behind the Univalent Foundations program. I had read it before around the time of his passing, and one passage that I remember vividly is this, for which I have little in the way of rigorous justification:

The greatest roadblock for me was the idea that categories are “sets in the next dimension.” I clearly recall the feeling of a breakthrough that I experienced when I understood that this idea is wrong. Categories are not “sets in the next dimension.” They are “partially ordered sets in the next dimension” and “sets in the next dimension” are groupoids.
— Voevodsky, The Origins and Motivations of Univalent Foundations

If I had to guess, I'd say that the noninvertibility of morphisms in categories corresponds to some form of partial ordering, whereas a groupoid carries no such information since all morphisms are in fact isomorphisms, but surely there's something deeper at play that caused someone like Voevodsky to consider this realisation a "breakthrough" that accompanied a significant "roadblock".

A:

First, there is indeed nothing mathematically very deep in this observation, and I agree that the word "breakthrough" might be exaggerated. But on the other hand lots of very deep ideas look trivial once spelled out explicitly. Moreover being younger than Voevosky I have never been really exposed to the idea that categories were sets of higher dimension (but this indeed appears in the early work on higher categories, typically in Baez & Dolan's work), so I can't comment on how important it was to understand that this is not a good point of view. But I can give some context on what Voevodsky probably meant here.
One thing to understand is that, like many mathematicians and most category theorists, Voevodsky is very attached to the "principle of equivalence" saying that when talking about categories you should only use concepts that are invariant under equivalence of categories. For example, in his work on contextual categories, he renamed them "C-systems" because he didn't want to call them categories as their definition is not invariant under equivalence of categories.
Now, if you follow this principle of equivalence very strictly, talking about "the set of objects of a category" is not meaningful (i.e. break the principle of equivalence):
equivalent categories can have non-isomorphic sets of objects.
So saying that a category is "a set of objects together with a set of arrows having a certain structure" is incorrect from this perspective.
It is true that if you have a set of objects and a set of arrows with the appropriate structure you get a category, and it is also true that any category can be obtained this way, but you cannot recover the set of objects and the set of arrows from the category without breaking the principle of equivalence. To some extent the set of objects and of arrows with the appropriate structure is a "presentation" of your category.
What is meaningful though (i.e. respects the principle of equivalence) is that a category has a "groupoid of objects" $X$, with a bifunctor $Hom : X \times X \rightarrow Set$
From the point of view of the principle of equivalence, a category is really a groupoid with structure. Moreover this structure is a very natural categorification of the notion of poset:

A poset is a set X with a function $X \times X \rightarrow Prop$ satisfying reflexivity, anti-symmetry and transitivity.
A category is a groupoid $X$ with a functor $X \times X \rightarrow Sets$, satisfying some conditions. Reflexivity corresponds to the existence of an identity, transitivity corresponds to the composition operation, and anti-symmetry corresponds to the fact that in the end one wants $X$ to be the core groupoid of the category.

But if you really take the principle of equivalence seriously, you cannot define what a "groupoid" is, you have to take it as a primitive notion that you axiomatize. But this is not really different from the fact that you cannot define what a "Set" is, you can only axiomatize what you can do with sets.
It is in this sense that groupoids are "higher dimensional sets" and categories are groupoids with a structure.
This has been made even more clear with the theory of $(\infty,1)$-categories, where it is completely clear that $\infty$-groupoids play the role that sets played for ordinary categories. (The $(\infty,1)$-categorical Yoneda lemma is in terms of functors to the category of $\infty$-groupoids etc...)
Another way to say this is that in the $n$-categorical hierarchy "0-groupoid"s are just sets while $0$-categories are posets (if you consider them as $(n,1)$-categories for varying $n$...)

A:

The other answers are quite good and nothing is wrong with them, but lest a wrong impression be given (e.g. by the implicit suggestion that the idea of "categories as sets in the next dimension" in early work on higher categories was "wrong"), I want to add that while Voevodsky is of course correct from a certain point of view, there is another valid point of view according to which categories are, indeed, "sets in the next dimension".
The point is that you have to have two orthogonal axes of "dimension".  David Corfield mentioned this briefly in a comment: instead of just $n$-categories, consider $(n,r)$-categories: categories with (potentially) nontrivial $k$-morphisms for $0\le k\le n$, but where all $k$-morphisms are invertible for $k>r$.  Here "0-morphisms" are objects, and it doesn't make sense to ask for them to be invertible, so $r\ge 0$.  Thus for instance:

A (1,1)-category is a 1-category in the usual sense: objects (0-morphisms) and arrows (1-morphisms), not required to be invertible.
A (1,0)-category is a groupoid: objects and arrows, but the arrows are required to be invertible.
A (2,2)-category is a 2-category in the usual sense: objects, arrows, and 2-cells, none required to be invertible.
A (2,1)-category is a 2-category all of whose 2-cells are invertible, but whose 1-morphisms may not be, i.e. a category (perhaps weakly) enriched over groupoids.
A (2,0)-category is a 2-groupoid: a 2-category all of whose 1-morphisms and 2-morphisms are (perhaps weakly) invertible.
An $(\infty,0)$-category is an $\infty$-groupoid: it has cells of all dimension, all invertible.
An $(\infty,1)$-category is what Lurie's school calls an "$\infty$-category": it has morphisms of all dimension, all invertible except the 1-morphisms.
A (0,0)-category is a set: only objects, no invertibility requirements.

Now you might think from the definition of $(n,r)$-category that you would have to have $r\le n$.  But in fact there is a natural way to extend it to the case $r=n+1$.  For when $r\le n$, we can identify $(n,r)$-categories (up to equivalence) as $(n+1,r)$-categories in which any two parallel $(n+1)$-morphisms are equal.  Then we can take the latter when $r=n+1$ as a definition of $(n,n+1)$-category.  This gives:

A (0,1)-category is a 1-category in which any two parallel 1-morphisms are equal, i.e. (up to equivalence) a poset.
A (1,2)-category is a category enriched over posets, or equivalently a 2-category in which all hom-categories are posets.

Now we can see how the "raising dimension" step that Voevodsky was thinking of takes sets to groupoids and posets to categories: just add one to $n$ in $(n,r)$.

$(0,0) \mapsto (1,0)$
$(0,1) \mapsto (1,1)$

But there's another natural "raising dimension" step that does indeed take sets to categories: add one to both $n$ and $r$.

$(0,0) \mapsto (1,1)$

Since in common usage "$n$-category" for $n\ge 1$ refers to an $(n,n)$-category, it is therefore very natural to say that it is sets, i.e. (0,0)-categories, deserve the name "0-categories", whereas posets should be called (0,1)-categories.
So I think Voevodsky's phrasing of his breakthrough may have been a bit too dogmatic.  The point isn't that it's "wrong" to regard categories as sets in the next dimension (or at least a next dimension).  The point is that it's also valid to regard groupoids as sets in the next dimension, and that this latter point of view is extremely fruitful, leading in particular to univalent foundations but also (somewhat independently) to the recent boom in $(\infty,1)$-category and $(\infty,n)$-category theory.

A:

Even if this answer can be seen as an expansion of the last two lines of Simon's answer, it does not really come in the same spirit.
From the point of view of enriched category theory, posets are categories enriched over the boolean algebra $2=\{\bot < \top\}$. Very often this enriched category theory is called $0$-category theory.
$$\text{Pos} = 0-\text{Cat}.  $$
The concept of groupoid is not enrichment dependent, but the actual incarnation of such is.  When one looks at groupoids in this context, sets arise. It would be better to say discrete posets.
$$ \text{Sets} = 0-\text{Grpd}. $$
Obviously, changing site of enrichment from $2$ to Set one gets that Cats are Set-Categories and Grpds are Set-Groupoids. 
$$\text{Cat} = \text{Set}-\text{Cat},  $$
$$\text{Grpd} = \text{Set}-\text{Grpd}.  $$
Very often, especially in the context of homotopy theory, Set-category theory is called $1$-category theory.
To come closer to Simon's answer, one should observe that technically $0$-groupoids correspond to setoids and not sets.  For several reasons, especially in these days of homotopy type theorists, setoids might be a more convinient category of sets. 
Talking about posets, they correspond to skeletal $0$-categories, while $0$-categories are preorders.

