You have to build the GMP extension from the PHP source code. First install Autoconf and GMP using Homebrew.
brew install autoconf gmp
Download and unpack PHP.
http://php.net/get/php-7.2.10.tar.bz2/from/a/mirror
$ cd php-7.2.10/ext/gmp
$ /Applications/MAMP/bin/php/php7.2.10/bin/phpize
$ ./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.10/bin/php-config
$ make
$ make install
Add the extension loading config to php.ini
in /Applications/MAMP/bin/php/php7.2.10/conf
and restart servers MAMP.
extension=gmp.so
Looking at the PHP information should display something like.