So the sampled wave period is actually $\frac{7}{700 \mathrm{Hz}} = \frac{1}{100 \mathrm{Hz}}$ -- I assume that's just a typo on your part.
There's a principle in Fourier analysis that sometimes people miss. It's that Fourier invented this stuff to make life easy -- so if it's harder to do it in the frequency domain just do it in the time domain.
For example, I can work out the $40000 = (57 \frac 1 7)(700)$ bit in my head, so I know that sampling almost anything with a period of $T = \frac 1 {700 \mathrm{Hz}}$ at 40000Hz is going to have a period of 10ms.
Now that we've used the easy way (the time domain) to assure ourselves what we're going to find in the frequency domain, the imprecise answer is that a square wave at $700 \mathrm{Hz}$ has only odd harmonics; i.e., there's harmonics at $(700 \mathrm{Hz})n\ \forall\ n \in \mathrm{odd}$. When you sample, the source spectrum will appear, as well as all possible shifted versions of it, shifted on intervals of $40000 \mathrm{Hz}$. This means that every possible frequency $$f = (700 \mathrm{Hz})n + (40000 \mathrm{Hz})m\ \forall\ n \in \mathrm{odd},\ m \in \mathbb I \tag 1$$ is in there.
Because the greatest common divisor of $700 \mathrm{Hz}$ and $40000 \mathrm{Hz}$ is $100 \mathrm{Hz}$, we know that the only possible values of $f$ are ones divisible by $100 \mathrm{Hz}$. This is the spectrum of a wave that repeats every 10ms.
So in the frequency domain we've worked out something with a lot of shaky math, some handwaving, and some brain cell curling messing around with integers just to find out something we could reason out in two seconds in the time domain. But at least we have the satisfaction of knowing that the time domain and frequency domain agree, and so the DSP world has not gone mad.