How does a computer allocate memory in hardware?(pointers,stack, heap)
Stack and heap are software concepts. Computers deal with physical and (if available) virtual address spaces. I'll try to outline basics. Some things are not exactly as described and stuff is in general much more complex.
Data (code is data too) is kept in some ROM or RAM. This memory is attached to a bus (communication thingie) which allows other devices attached to it (e.g. CPU) ask for certain range of data or set data in some range. You can think of a physical memory as if it were a bunch of pigeon holes indexed from 0 to however many there are. CPU sends commands over the bus like "give me whatever is in pigeon hole 16" and then uses data received. Or it can send command "store zero in pigeon hole 5" and get that done. If physical address space is all you've got, this is roughly what happens when you read/write data.
In many cases however applications deal with virtual address space. This allows you to address pigeon holes from 0 to however many bits in address you have. So e.g. 32-bit address space would let you get/set values in up to 4gigaholes.
But these pigeon holes are virtual, they don't correspond to any real place in physical memory, unless someone governs how VA is associated with PA. Translation between PA and VA is managed by OS but aided by a hardware piece called Memory Management Unit (MMU). MMU is a hardware unit that handles lookup tables (LUT) where you say to the MMU "I'm about to use virtual address 1000" and MMU responds "this is mapped into physical address 10".
In a simple scenario you've got one set of VA. Every time you malloc a memory in your program, something looks into the PA space available and associates a range of PAs with a range of VAs (builds entry in the LUT handled by the MMU). Somehow, someone has to manage data structures that describes ranges already used and ranges that are free - both physical and virtual. This could be a piece of HW or this could be a piece of SW. This LUT usually has multiple levels of indirection called page directories, page tables and/or something else entirely.
In reality MMU most likely sits between your CPU and bus so whenever CPU is sending request to the bus, addresses are automatically translated from VA to PA based on the LUT attached. The LUT itself is just a bunch of data (potentially in the physical memory) that MMU references (over the bus obviously) to do the translation. Translation is often done page by page. In other words: address spaces is divided into fixed-size pages (4kB, 64kB, others) so index into the page is the same for both VA and PA. In other words: lower bits are the same regardless of address space and higher bits of the VA are only translated by the MMU to PA space.
In multi-process environments you'll have multiple processes dealing with their own VA spaces. What happens when processes are switched back and forth is that pointer to the LUT MMU is using will change (it will perform different translation for different processes).
Free is pretty simple once you wrap your head around this - it just frees PA and VA range (removes entry from the LUT). Pointers in your C code are values representing VA. When you read from a given address, MMU does translation and provides data from the physical memory. Stack and heap are just separate ranges of memory your application is using: stack is potentially fixed range that you use more or less of, in a linear fashion, based on how deep you call functions. Heap is everything else.
How does it move data to and from the registers and main memory?
When bus responds with data from a given address, CPU has to store that somewhere. It does so in its register bank.
How does it know when one instruction ends and another begins?
Instructions are data: CPU reads this data in a sequential fashion (unless you branch in your code) and interprets this as commands, e.g. 0 would mean move data between registers, 1 would mean add values from two registers, 2 would mean multiply, and so on.
In general: this is a very, very broad topic that won't be explained on the board in details. Get a book on computer architecture and read it.