There are already a number of answers on Stackoverflow pointing out the different technologies. However, I do not think there is a clear comparison. I've been in the OSGi from the beginning as well as has been quite present in the JPMS development since 2004.
Sadly, JPMS is a surprisingly bad impression of a module system. It walks like a module system, it talks like a module system but it definitely isn't since it lacks the intrinsic properties of modules: information hiding. It does an admirable job of giving the impression but just try to use the same class name in two unrelated modules. For example, you need to have 2 versions of the same class. This violates the primary purpose of modularity that you can do whatever you want in the private area of a module; it should not affect the whole.
This may sound as a far fetched complaint but it is actually a very common use case in OSGi. Instead of depending on an external module, you package the module internally to simplify the overall operations. In JPMS, you will have to complicate your build and shade. And then still someone might conflict with your private namespace.
For me, this would be sufficient to disqualify JPMS. You also ask about microservices. Microservices are however not modules. They are, however, imho an absolutely necessary aspect of modular thinking. A crucial aspect of module systems are dependencies. The popular build system maven uses a module to module dependency model that is very simple and very powerful but for larger systems it will create a very hard to control transitive dependency model that tends to have a massive fan-out. Maybe it is people that download the internet for a simple hello world
but the module-to-module dependencies do make it absolutely too easy to create a mess for large complex applications.
Microservices change the module-to-module dependencies to module-to-services dependencies. The fantastic success of microservices is largely because it allows modules to evolve independently by providing the same API to their microservices while the module evolves. This breaks the transitive dependencies and significantly simplifies the overall complexity of a system. Although JPMS has the Service Loader model, this is such a poor mans implementation of microservices that it hardly deserves to be mentioned. It is static and completely ignored in the dependency model.
So far, I left microservices relative vague; basically they are a conduit between modules. However, in the big world out there microservices are generally understood to be something like REST services. However, their architectural advantages (breaking the transitive dependency model) are not depending on their communication technology. The benefits are caused by having a clear endpoint to communicate with that has a cohesive API.
OSGi coined the term µservices since the early 2000's. The core programming model in OSGi is to create modules that register services and get services. A good OSGi system only communicates over these services. Since an OSGi service is a plain old Java object, the (minimal) overhead is limited to setup.
Since we designed OSGi to be reflective from day one, it is possible to map an applicable OSGi service to a communication endpoint, e.g. a REST service or MQTT topic. This mapping can be done without any knowledge in the actual services. This is all standardized in Remote OSGi services. The dynamic nature of OSGi provided and excellent foundation since it provides the substrate to handle the fallacies of distributed computing.
One of the primary software laws is cohesion; in OSGi you can keep your modules, packages, classes, and methods maximally cohesive.
To provide the cherry on the cake, OSGi integrated the µservices in their native dependency model. An OSGi application consists of hundreds of modules that interact with each other over hundreds of services. Modules only depend on well defined services. Services can be provided by different modules, which could get messy quickly. Fortunately, the OSGi therefore provides a resolver to select an assembly of modules where all the module requirements (which includes the services) are met.
To conclude. Neither JPMS nor microservices are proper module systems. Only with OSGi do you get a real module system that has private and integrates natively with microservices.
See also Difference between OSGi services and REST microservices