For Android, users of your app can be excluded automatically, as long as the package name has been set up correctly in the Settings page of the Facebook app set up.
For iOS users, actions need to be taken to ensure that Facebook detects whether or not a user has the app installed. The actions needed depend on the version of iOS on the user's device.
For iOS 9.0+ the only way to exclude users is sending app events to Facebook. Facebook excludes users that have sent an app event within 180 days. Therefore, it is important to send events to Facebook based on the user's app usage. For more information regarding sending the events, see here.
For iOS 8.x and below Facebook excludes users for which they can detect that your app is installed. Facebook detects apps in two different ways:
Matching a provided deeplink url with the url schemes registered for the app. Therefore, using a deeplink in your ad will allow Facebook to exclude users that already have your app installed.
Configure the application's info.plist file to register a url scheme for your app. See the detailed instructions here.