The liquid state of matter can do this, as its atoms aren’t as tightly connected as the ones in solids. Imagine you have a big pile of marbles. In this analogy, solids would be strong magnetic marbles, which, once formed, would keep their shape. Liquids would be like barely bonded marbles, basically loose, which would accomodate themselves to the bowl where they would be in. And gas would be floating marbles, flying around, spreading whenever empty space can be found.