Of course it's grammatical. Plus, it's more natural than *put the socks on*. Now, an elliptically reduced version doesn't guarantee that the exact original version should also work. For example, _I always have_ is an ellipted version of _I always have loved you_ in the following example, but the latter doesn't work: >I love you, and I always have. >??I love you, and I always have loved you. >I love you, and I have always loved you. The original version that's correct is the last one, which is not the exact original version. If you replace *the socks* with *them* in your example, the only ellipted version that's correct corresponds to the exact original version: >Put them on. >Put them on your feet. >??Put on them. The last version that's now incorrect corresponds to the most natural ellipted version of your example: _Put on the socks_.