When they teleported to other ships, even old, dead derelicts, they never seemed to lack gravity.
It is probably best to just watch and enjoy “Star Trek” rather than think too much about it.
They do make some weak attempts to explain why everyone speaks American English but that has to be a big what if too.