You can only fill space with constructions. Since there's no way to place natural stone and earth, once you've dug an area out, you can only refill space you dug out by ordering constructions like walls and fortifications to be built.
Actually, there are two alternatives to constructions that are especially dwarfly and are much more Fun™, but require enough additional work that you are probably not looking for this sort of thing. For completeness though, you can:
Fill the area with obsidian. Flood the area with lava, then water. The obsidian will count as "natural" since it was formed, not constructed, but if you're looking for earth or stone this wont help. Also note that unless the area is impeccably sealed off, dwarfs have a tendency to go for a swim in the lava for Fun™.
Drop a suspended layer of earth/stone into the spot you want filled. A layer of natural material that is completely separated from the surrounding material (beside, above, and below) that collapses all at once will simply fill the space below instead of pulverising into rubble. To achieve a perfect collapse you can keep the layer connected to solid ground above via a Support – connect a lever on that support, and when a dwarf pulls it the support will vanish, dropping the chunk. As an engineering task this is quite the challenge if you've never done it before, but has the benefit of being a nice practice project for punching through aquifers. Dwarfs have a tendency to stand in exactly the wrong spot when the detracted layer drops, so make sure you have a "functioning" hospital before pulling the lever.
Using magma to melt ice in freezing terrain, pump the water where you want it to make a wall, and then pumping away the magma to let the water freeze into ice. An excellent exercise for learning about the uses, features, and dangers of freezing temperatures. Also an excellent exercise for learning about magma-safe materials. (Dwarfs are not made of magma-safe materials.)