Fouls are called when the ball hits the ground or is caught outside of the foul lines. They can also occur when a pitched ball hits a batter.
On a softball diamond, lines exist called the foul lines. These lines are drawn from the back or home plate, to the backside of the first and third base bags, all the way to the outfield. At the end there are two "foul poles" which, despite their name, are usually in fair territory. The two bases, first and third, are in fair territory as is home plate. On fly balls to the outfield, any ball that is batted that lands in foul territory is a foul ball. If it lands inside the two lines it is a fair ball.
A ball caught in foul territory is still foul. However, a runner can still tag up on a fly ball caught by a fielder in foul territory. A ball that hits the ground in foul territory is dead and runners cannot advance. WIth ground balls in the infield, the bases, third and first, are the indicators of a fair or foul ball. Where the ball passes those bases will determine if a ball is fair or foul. A ground ball that first hits foul, for instance, but spins and passes first base on the inside of the line is a fair ball. Conversely, a ball that starts fair but bounces outside of the base is foul. Both bases are in fair territory, a ground ball that hits the base is fair and in play.
Inside the batter's box is technically in fair territory. However if a ball is pitched and hits the batter while they are still inside the batter's box, the ball is then foul. It is fairly common in softball for a ball to hit the batter's leg. That ball is a foul ball.