Plugins may not contain functionality that is restricted or locked, only to be made available by payment or upgrade. They may not disable included functionality after a trial period or quota. Paid functionality in services _is_ permitted (see guideline 6: serviceware), provided all the code inside a plugin is fully available.
A common business model is to make a free version available on .org without any restricted features and then sell a separate plugin elsewhere that either includes all the features or just adds them to the free version.
This is a policy of .org and not necessarily a legal matter.
Regarding legal issues you probably shouldn’t listen to strangers on the internet. But this is a topic that has been written about extensively. I found this article particularly good: https://michaeltorbert.com/wordpress-plugin-theme-gpl/
]]>