In a sentence like this one
Fishes swim in the water.the prepositional phrase "in the water" acts as an adverb modifying "swim." The preposition "in" tells us that the phrase has to do with space and, more precisely, location relative to "the water." Other prepositions work similarly, modifying nouns and verbs by defining the relationships between them and other things.
The noun, noun phrase or pronoun that follows the preposition is called the object of the preposition. The object of a preposition will generally be in the accusative or the dative case (rarely the genitive), depending on the preposition or the meaning it has in context. Your textbook should tell you the case that each preposition takes.