In a classical sense, the Sonata is a structure composed of three sections:
- development, and
Are there any examples of a Sonata with only two sections?
Two leading music scholars of our generation, Jim Hepokoski and Warren Darcy, formulated what they call Sonata Theory (note the capital S and T!) to better understand the sonata process.
They list five types of sonatas. The Type 3 Sonata is the sonata that you describe, with exposition, development, and recapitulation. The Type 1 Sonata, however, is a sonata without development, which therefore only includes two of your three sections.
In my experience, the development is the only one of these three sections that is optional. It seems to me the exposition is mandatory, because without it nothing can be developed. And the recapitulation seems mandatory because without it the music will not return to tonic.
Lastly, the term "sonatina" is also used to discuss a sonata without a development, but the term isn't used consistently; sometimes a composer uses "sonatina" to just mean "easy sonata."
The term Sonata can be used for any instrumental piece.
The Sonata that you're thinking of is the classical Sonatensatz and needs to have these 3 section to be called as such.
The classical Sonata includes apart of the Sonata-Satz form a Menuet or Scherzo and other forms like Adagio-Satz, Lied-Satz, (AB: a form made up of two contrasting sections, each of which may or may not be repeated) and a Rondo.
A smaller Sonata that also may fit to what your meaning (only 2 sections) is called Sonatina.
The Sonataform (1. or 4. section in a "Sonata") includes the 3: exposition, development, and recapitulation.
A sonata that has only the exposition and the recapitulation or only a very short development section can be called a sonatina.
Early sonata forms from the transition between the Baroque and Classical periods can be based on a two part form. Essentially the material of the first half will move from the tonic key to the dominant key. Then the second half restates the material but with the key areas reversed, the second half starts in the dominant key and transitions to the tonic key. These movements may not necessarily be titled "sonata." In a suite of movements an allemande, courante, gigue, etc. may use the early sonata form. You could also look for examples in Scarlatti's shorter sonatas for harpsichord.
Examples of simple two part sonatinas can be found in many sources. They often are titled "sonatina" which makes them easy to find. You can also find examples in the Mozart Nannerl Notebook, but none of those are titled as "sonata" or "sonatina."
In these sonata forms the order of thematic material change between the initial presentation in the exposition and its second appearance in the recapitulation. The placement of the thematic material isn't what determines the form but instead the movement form tonic to dominant and back to the tonic. You could abstract the essential harmonic aspect of the form to...
||: I (V7/V) V :||: V(7) I :||
Very important is the sense that the dominant becomes a new tonic at the close of the first half. Then in the second half the dominant returns to its original function as the dominant of the opening tonic.
As a side note: you may want to read up on the distinction of sonata as a two part or three part form. The three part idea of course is: exposition, development, and recapitulation. But in terms of form and harmony it's more of a two part form. The traditional division of a sonata movement into two halves with a double bar repeat underscores the two part, binary aspect.
The ideas aren't mutually exclusive. Think about both when you assess any particular sonata. You can think of the third section as the development which may be optionally omitted, just a brief segue into the recapitulation which doesn't really constitute a formal section, or a long excursion to various keys which can be considered a bona-fide, formal section.