Matlab doesn't need to know a specific sampling frequency in order to implement the DFT/FFT. This comes from the definition of the forward DFT for a discrete-time signal (DT), $x[n]$, with $N$ entries (i.e. of finite length),
$$X_k = \sum_{n=0}^{N-1} x[n] e ^{-j 2 \pi \frac{kn}{N}}.$$
This definition does not make any use of the concept of a "sampling frequency". While it is common that a DT signal is generated by sampling a continuous time (CT) signal, many discrete signals do not have such an origin. Specifically, the "frequencies" of the DFT are references to periodicity within the samples according to the length of the DT signal. Take a look at the complex sinusoid used in the DFT:
$$ e^{-j 2 \pi \frac{k}{N} n} = \cos(2 \pi \frac{k}{N}n) - j \sin(2 \pi \frac{k}{N}n) = \cos(\omega_k n) - j \sin(\omega_k n)$$
where $\omega_k = 2 \pi \frac{k}{N}$ is dependent upon which frequency coefficient ($X_k$) you are solving for and the length of the signal ($N$). So, we see that the DFT computes a discrete number of frequency coefficients, where the maximum number of frequency coefficients which can be calculated is dependent upon the number entries in our original, finite length signal ($x[n]$), i.e. the frequencies
$$0,\frac{2 \pi}{N}, \frac{4 \pi}{N}, \frac{6 \pi}{N}, ..., \frac{2 \pi (N-1)}{N}.$$
In other words, the frequencies calculated using the DFT/FFT have to do with regularity at certain ratios of the signal length. So, regularities every one sample, two samples, three samples, etc.
Also, keep in mind that coefficients produced by the DFT/FFT are periodic, so when you view the DFT/FFT coefficients, as in Matlab, you are only observing a single period (or "replica") of the true spectrum. For more information on this, I would suggest reading up on, or asking about, the relationship between the DFT and the Discrete Time Fourier Transform (DTFT), which produces a continuous function of frequency for a set of discrete time entries.