If I have ComputerA that has their networking interface set with an MTU of 1500 and ComputerB has a network interface with an MTU of 1200 is there any way for ComputerA to know that ComputerB's MTU is 1200 or if it sends large packets it will get from ComputerB a request to fragment the packet?
The hosts can use Path MTU Discovery which is optional for IPv4 and mandatory for IPv6.
With IPv4, a packet is fragmented where it is larger than the egress interface's MTU - that can happen on the source host or any intermediate router. In your example, the router between A and B would fragment the packet.
Fragmentation can put considerable load on routers and was removed for IPv6 routers, so a v6 host needs to discover the path MTU for each destination or fragment oversized packets by itself. If an IPv6 router encounters an oversized packets it returns an ICMP error and drops it.
The MTU is a property of each interface. It is either (hardware) default, configured statically, or by DHCP (option 26). All nodes in a shared L2 segment need to use the same maximum frame size, resulting in the same MTU. If a node sends larger frames than the others can except these are dropped as oversized.
This is a bit of a sideline answer, as the question was about MTU, not MSS.
... and then there's TCP MSS, which helps in case of TCP, but of course not with UDP nor ICMP.
Using the MSS field in the TCP header (only in the SYN and SYN-ACK packets of the initial 3-way handshake), hosts can signal to their peers how large a TCP payload is acceptable to receive.
TCP MSS negotiation can be a blessing, but also a nuisance, as it helps to hide MTU problems until something with large UDP packets comes along and fails at the "all hosts on the common L2 segment need to use the same MTU" criterium (see Zac67's comment, above)
A host will derive the MSS from the MTU of the given egress interface used to communicate with the given peer. Usually, values of MTU-40 are seen (1460 for common ethernet), or even less if TCP timestamping is being used.
TCP MSS is a property of the given TCP session/socket; a jumbo frame enabled host will happily exchange TCP segments with a peer which has 1460bytes MSS just as well as one with 1160 bytes, while talking to the a backend system with an MSS of 8960 bytes, all simultaneously on the same single interface.
If the network path between the TCP speakers has tunneling features (such as an IPsec site2site-tunnel), routers, gateways or firewalls will often manipulate the TCP MSS field in the initial packets of a TCP session (usually to something like 1350 bytes); this is known as "mss clamping" or "adjust-mss", to make the end systems believe that the reciprocal remote peer could not receive larger packets, which would not fit through the tunnel without fragmentation (of course, if a host signals an MSS lower than the clamping value, the device will leave the lower value as it is)