In your loop, X(:,i) is the contents of the table variable, and you're using it with dot indicating it as the name of the variable.
I believe this is the code you're looking for (I added another variable to make it a slightly more robust test)
X1=[9 6 9;3 2 7];
X2=[0 2;4 0];
X3=[3 1 2; 8 9 7];
X4=[0;2];
X=table(X1,X2,X3,X4)
len=table2array(varfun(@(x) size(x,2),X)); % or varfun(@(x)size(x,2),X,'OutputFormat','uniform')
lmax=max(len);
idrest=find(len<lmax);
for i = idrest
temp=X.(i);
temp(:,end+1:lmax)=nan;
X.(i)=temp;
end
X