Why did Laplace invent the Laplace transform? What was the context? Was it before Fourier or after?
Laplace "invented" Laplace transform for applications to probability, namely to prove the special case of what is known now as the central Limit theorem (1785). According to Wikipedia, he used a special case that is called the $z$-transform nowadays (another, more common name is generating function). He also used other forms of the same idea, for example what is called Mellin's transform today.
In no way was Laplace the first. Generating functions can be found in the work on de Moivre on combinatorics/probability (Doctrine of chance, 1718). This is the earliest use of the general idea of harmonic analysis that I know.
Laplace transform (in the modern sense) was probably used for the first time by Euler in 1744 (again, the information from Wikipedia).
All this was long time before Fourier whose Analytic theory of heat was published in 1822. (There was a very long delay before the publication, but certainly Fourier made all these inventions in 19th century, until 1801 he had more important things to do:-).