Suppose you bought the class C range 18.104.22.168 /24. This range supports upto 254 addresses. But in your network you have two small separate networks each consisting of only 100. The range you have can obviously cover both networks but because the two networks are physically/organizationally separate, you can not assign them both the same range. Without subnetting the only way is to buy a new range (say 22.214.171.124/24) and assign it the second network. This is a complete waste of address space and budget. With subnetting you can simply split the first range into two (126.96.36.199/25 and 188.8.131.52/25) and give each network it's own sub range.
It's basically what S0lo said but it points out why you need subnets.
The short of it is..
Without subnets you have to allocate an entire class A B or C address block per network so we use subnets to allow routers to be able to find fragments of those blocks on different autonomous systems.
Think about it this way. Not using subnets:
You have 2 networks. You have an entire class C address range.
You give 184.108.40.206 to your A router for your A network
And you give 220.127.116.11 to your B router for your B network
You assign 18.104.22.168- 22.214.171.124 for hosts on Network A
You assign 126.96.36.199-194.1.140 for hosts on Network B
Then you let users try to communicate.
Host 188.8.131.52 tries to ping 184.108.40.206
The packet goes out the network interface card as a packet wrapped in a frame hits the first switch which then floods the requests out of all ports on the local LAN. Of course by flooding the frame it will eventually get to the network router which drops the packet due to filtering because without sub dividing IPs into some logical groups it thinks that 220.127.116.11 is within the same logical group as that source 18.104.22.168. (and if your next question is why do routers need logical groups the answer is route tables would simply be to big to record IP addresses and paths for every node)
Basically from the routers point of view when you tell it route a packet it from 22.214.171.124 to 126.96.36.199 it tells you it's not sending it because it should be on your local LAN anyways.
Subnetting solves this
Lets try 255.255.255.128 (/25) (one bit was used to identify that you broke the network in two groups)
Effectively you now have 2 SUB GROUPS of IP's (subnets) recognized by your routers.
A list of IP's that Range from
Effectively your networks are now identified by 188.8.131.52 for A and 184.108.40.206 for B both with a /25 mask.
So now lets go back to our example:
*note IP's changed with allowable addresses
Host 220.127.116.11 on Network A
wants to ping
Host 18.104.22.168 on Network B
The network interface card kicks our the frame holding the packet to the local switch.
Switch doesn't recognize the mac address so it floods to all ports
eventually hitting the network router.
This time around the network router gets the packet and it forwards it instead of filtering it.
And the million dollar question is why did it forward it with subneting instead of filtering it out?
The answer is:it looked at the subnet ID 22.214.171.124 and the mask of 255.255.255.128 and realized 126.96.36.199 can't be in the same range as 188.8.131.52 because that subnetwork grouping only goes to 127.
Continuing on the router passes the packet along it's default route where the next router which receives it similarly evaluates 184.108.40.206 /25 to be on a different network then 220.127.116.11/25 and passes it hop to hop till it eventually gets to the router that knows 18.104.22.168 /25 must be on network 22.214.171.124/25 and forwards it accordingly.
To summarize: subnets subdivide networks.
Subdivision allows routing to be manageable.
(Manageability is created because your grouping things up.)
Without division you do not have a reasonable logical way of knowing where something is.