Have you equiped your companion with a horse and it is still not shown in the formation?
That is correct. A companion equipped with horse, spear, shield, javelin and sword will stay in infantry formation. This only happens if that companion is not assigned as a captain and I have more than 1 companion with same equipment. For example, 3 calvary companions, 2 will stay with my character in the cavalry and 1 will stay in infantry (on a horse).
Another situation is when I marry a character that comes with a horse and bow, remove the horse, but now she will stay with horse archers even though she is on foot. I have not found a way to get that companion to move to the archer formation.