The manage().window().getSize() has to be executed in the Protractor's control flow which would not be yet initialized if you call it outside of before*(), after*() or it() contexts. 
Just put your condition into the test itself:
function getWidth() {
    return browser.manage().window().getSize().then(function(size) { 
        return size.width
    });
}
it ('test following', () => {
    getWidth().then(function (width) {
        if (width > 500) {
            // test something
        }
        else {
            console.log("Skipped testing something");
        }
    });
})
Or, depending on your use case, you can set the dimensions of the browser window for a specific capability (example) in your protractor config and specify tests that would be executed for this capability - this should eliminate the need to do this check in the test itself.